本文整理汇总了Python中win32con.SW_HIDE属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.SW_HIDE属性的具体用法?Python win32con.SW_HIDE怎么用?Python win32con.SW_HIDE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类win32con
的用法示例。
在下文中一共展示了win32con.SW_HIDE属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LoadMainFrame
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import SW_HIDE [as 别名]
def LoadMainFrame(self):
" Create the main applications frame "
self.frame = self.CreateMainFrame()
self.SetMainFrame(self.frame)
self.frame.LoadFrame(win32ui.IDR_DEBUGGER, win32con.WS_OVERLAPPEDWINDOW)
self.frame.DragAcceptFiles() # we can accept these.
self.frame.ShowWindow(win32con.SW_HIDE);
self.frame.UpdateWindow();
# but we do rehook, hooking the new code objects.
self.HookCommands()
示例2: GUIAboutToFinishInteract
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import SW_HIDE [as 别名]
def GUIAboutToFinishInteract(self):
"""Called as the GUI is about to finish any interaction with the user
Returns non zero if we are allowed to stop interacting"""
if self.oldForeground is not None:
try:
win32ui.GetMainFrame().EnableWindow(self.oldFrameEnableState)
self.oldForeground.EnableWindow(1)
except win32ui.error:
# old window may be dead.
pass
# self.oldForeground.SetForegroundWindow() - fails??
if not self.inForcedGUI:
return 1 # Never a problem, and nothing else to do.
# If we are running a forced GUI, we may never get an opportunity
# to interact again. Therefore we perform a "SaveAll", to makesure that
# any documents are saved before leaving.
for template in win32ui.GetApp().GetDocTemplateList():
for doc in template.GetDocumentList():
if not doc.SaveModified():
return 0
# All documents saved - now hide the app and debugger.
if self.get_option(OPT_HIDE):
frame = win32ui.GetMainFrame()
frame.ShowWindow(win32con.SW_HIDE)
return 1
#
# Pythonwin interface - all stuff to do with showing source files,
# changing line states etc.
#
示例3: OnInitDialog
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import SW_HIDE [as 别名]
def OnInitDialog(self):
self.SetWindowText(self.appName)
butCancel = self.GetDlgItem(win32con.IDCANCEL)
butCancel.ShowWindow(win32con.SW_HIDE)
p1 = self.GetDlgItem(win32ui.IDC_PROMPT1)
p2 = self.GetDlgItem(win32ui.IDC_PROMPT2)
# Do something here!
p1.SetWindowText("Hello there")
p2.SetWindowText("from the demo")
示例4: ShowDW
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import SW_HIDE [as 别名]
def ShowDW(self, bShow):
if bShow:
self.toolbar.ShowWindow(win32con.SW_SHOW)
else:
self.toolbar.ShowWindow(win32con.SW_HIDE)
示例5: start
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import SW_HIDE [as 别名]
def start(self, cmd):
sAttr = win32security.SECURITY_ATTRIBUTES()
sAttr.bInheritHandle = True
stdout_r, stdout_w = win32pipe.CreatePipe(sAttr,0)
stdin_r, stdin_w = win32pipe.CreatePipe(sAttr,0)
self.read_handle=stdout_r
self.write_handle=stdout_w
self.stdin_write=stdin_w
si = win32process.STARTUPINFO()
si.dwFlags = win32process.STARTF_USESHOWWINDOW | win32process.STARTF_USESTDHANDLES
si.wShowWindow = win32con.SW_HIDE
si.hStdInput = stdin_r # file descriptor of origin stdin
si.hStdOutput = stdout_w
si.hStdError = stdout_w
hProcess, hThread, dwProcessID, dwThreadID = win32process.CreateProcess(None,"cmd", None, None, True, win32process.CREATE_NEW_CONSOLE, None, None, si)
self.dwProcessID=dwProcessID
self.hProcess=hProcess
sleep(0.5)
if self.hProcess == 0:
DebugOutput("Start Process Fail:{:d}".format(win32api.GetLastError()))
DebugOutput('[*] pid: {:x}'.format(self.dwProcessID))
self.Console_hwnd = get_hwnds_for_pid(self.dwProcessID)
if len(self.Console_hwnd)==0:
raise Exception("Fail to run,No Process!")
DebugOutput('[*] hwnd:{:x}'.format(self.Console_hwnd[0]))
示例6: hide
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import SW_HIDE [as 别名]
def hide(self, new=True):
"""Hide a window from the task bar.
Kept the old way just to be on the safe side.
"""
if new:
win32gui.ShowWindow(self.hwnd, False)
else:
self.minimise()
win32gui.ShowWindow(self.hwnd, win32con.SW_HIDE)
win32gui.SetWindowLong(self.hwnd, win32con.GWL_EXSTYLE,
win32gui.GetWindowLong(self.hwnd, win32con.GWL_EXSTYLE) | win32con.WS_EX_TOOLWINDOW)
win32gui.ShowWindow(self.hwnd, win32con.SW_SHOW)
示例7: hide
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import SW_HIDE [as 别名]
def hide(self):
print("hide")
win32gui.ShowWindow(self.hwnd, win32con.SW_HIDE)
self.hidden = True
示例8: set_visibility
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import SW_HIDE [as 别名]
def set_visibility( self, visibility ):
state = win32con.SW_SHOW if visibility else win32con.SW_HIDE
win32gui.ShowWindow( self.window_handle, state )
win32gui.UpdateWindow( self.window_handle )
示例9: runAsAdmin
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import SW_HIDE [as 别名]
def runAsAdmin(cmdLine=None, wait=True):
if os.name != 'nt':
raise RuntimeError, "This function is only implemented on Windows."
import win32api
import win32con
import win32event
import win32process
from win32com.shell.shell import ShellExecuteEx
from win32com.shell import shellcon
python_exe = sys.executable
if cmdLine is None:
cmdLine = [python_exe] + sys.argv
elif type(cmdLine) not in (types.TupleType, types.ListType):
raise ValueError, "cmdLine is not a sequence."
cmd = '"%s"' % (cmdLine[0],)
# XXX TODO: isn't there a function or something we can call to massage command line params?
params = " ".join(['"%s"' % (x,) for x in cmdLine[1:]])
cmdDir = ''
#showCmd = win32con.SW_SHOWNORMAL
showCmd = win32con.SW_HIDE
lpVerb = 'runas' # causes UAC elevation prompt.
# print "Running", cmd, params
# ShellExecute() doesn't seem to allow us to fetch the PID or handle
# of the process, so we can't get anything useful from it. Therefore
# the more complex ShellExecuteEx() must be used.
# procHandle = win32api.ShellExecute(0, lpVerb, cmd, params, cmdDir, showCmd)
procInfo = ShellExecuteEx(nShow=showCmd,
fMask=shellcon.SEE_MASK_NOCLOSEPROCESS,
lpVerb=lpVerb,
lpFile=cmd,
lpParameters=params)
if wait:
procHandle = procInfo['hProcess']
obj = win32event.WaitForSingleObject(procHandle, win32event.INFINITE)
rc = win32process.GetExitCodeProcess(procHandle)
# print "Process handle %s returned code %s" % (procHandle, rc)
else:
rc = None
return rc
示例10: _WindowsShutdownBlocker
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import SW_HIDE [as 别名]
def _WindowsShutdownBlocker(title='Python script'):
"""
Block Windows shutdown when you do something important.
"""
from ctypes import CFUNCTYPE, c_bool, c_uint, c_void_p, c_wchar_p, windll
import win32con
import win32gui
def WndProc(hWnd, message, wParam, lParam):
if message == win32con.WM_QUERYENDSESSION:
return False
else:
return win32gui.DefWindowProc(hWnd, message, wParam, lParam)
CALLBACK = CFUNCTYPE(c_bool, c_void_p, c_uint, c_void_p, c_void_p)
wc = win32gui.WNDCLASS()
wc.style = win32con.CS_GLOBALCLASS | win32con.CS_VREDRAW | win32con.CS_HREDRAW
wc.lpfnWndProc = CALLBACK(WndProc)
wc.hbrBackground = win32con.COLOR_WINDOW + 1
wc.lpszClassName = "block_shutdown_class"
win32gui.RegisterClass(wc)
hwnd = win32gui.CreateWindow(wc.lpszClassName, title,
win32con.WS_OVERLAPPEDWINDOW, 50,
50, 100, 100, 0, 0,
win32gui.GetForegroundWindow(), None)
win32gui.ShowWindow(hwnd, win32con.SW_HIDE)
windll.user32.ShutdownBlockReasonCreate.argtypes = [c_void_p, c_wchar_p]
windll.user32.ShutdownBlockReasonCreate.restype = c_bool
windll.user32.ShutdownBlockReasonCreate(
hwnd, "Important work in processing, don't shutdown :-(")
yield
windll.user32.ShutdownBlockReasonDestroy.argtypes = [c_void_p]
windll.user32.ShutdownBlockReasonDestroy.restype = c_bool
windll.user32.ShutdownBlockReasonDestroy(hwnd)
win32gui.DestroyWindow(hwnd)
win32gui.UnregisterClass(wc.lpszClassName, None)