Python win32con.SW_HIDE Examples
The following are 11
code examples of win32con.SW_HIDE().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
win32con
, or try the search function
.
Example #1
Source File: winpty.py From marsnake with GNU General Public License v3.0 | 6 votes |
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]))
Example #2
Source File: admin.py From uac-a-mola with GNU General Public License v3.0 | 6 votes |
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
Example #3
Source File: console.py From eavatar-me with Apache License 2.0 | 6 votes |
def hide(self): print("hide") win32gui.ShowWindow(self.hwnd, win32con.SW_HIDE) self.hidden = True
Example #4
Source File: dbgpyapp.py From ironpython2 with Apache License 2.0 | 5 votes |
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()
Example #5
Source File: debugger.py From ironpython2 with Apache License 2.0 | 5 votes |
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. #
Example #6
Source File: dojobapp.py From ironpython2 with Apache License 2.0 | 5 votes |
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")
Example #7
Source File: ietoolbar.py From ironpython2 with Apache License 2.0 | 5 votes |
def ShowDW(self, bShow): if bShow: self.toolbar.ShowWindow(win32con.SW_SHOW) else: self.toolbar.ShowWindow(win32con.SW_HIDE)
Example #8
Source File: main.py From MouseTracks with GNU General Public License v3.0 | 5 votes |
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)
Example #9
Source File: notice_dlg.py From eavatar-me with Apache License 2.0 | 5 votes |
def hide(self): print("hide") win32gui.ShowWindow(self.hwnd, win32con.SW_HIDE) self.hidden = True
Example #10
Source File: winapi.py From gui-o-matic with GNU Lesser General Public License v3.0 | 5 votes |
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 )
Example #11
Source File: utils.py From QuLab with MIT License | 4 votes |
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)