Python win32con.SW_SHOWNORMAL Examples

The following are 4 code examples of win32con.SW_SHOWNORMAL(). 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: admin.py    From uac-a-mola with GNU General Public License v3.0 6 votes vote down vote up
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 #2
Source File: helloapp.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def InitInstance(self):
        self.frame = HelloWindow()
        self.frame.ShowWindow(win32con.SW_SHOWNORMAL)
        # We need to tell MFC what our main frame is.
        self.SetMainFrame(self.frame)
        
# Now create the application object itself! 
Example #3
Source File: rescaletime.py    From cross3d with MIT License 5 votes vote down vote up
def maximizeMax(self):
		"""
			Maximize max to ensure that the Time Configuration button is on the monitor and clickable, and to 
			ensure that the dialogs will be on screen.
		"""
		self.restoreMaxWindow = False
		maxHwnd = GetWindowHandle()
		if GetWindowPlacement(maxHwnd)[1] == win32con.SW_SHOWNORMAL:
			ShowWindow( maxHwnd, win32con.SW_MAXIMIZE )
			self.restoreMaxWindow = True
			QTimer.singleShot(self.timerDelay, self.mouseToTimeButton)
			return
		self.mouseToTimeButton() 
Example #4
Source File: WindowsUI.py    From Poco with Apache License 2.0 5 votes vote down vote up
def SetForeground(self):
        win32gui.ShowWindow(self.root.Handle, win32con.SW_SHOWNORMAL)  # 先把窗口取消最小化
        UIAuto.Win32API.SetForegroundWindow(self.root.Handle)  # 再把窗口设为前台,方便点击和截图
        return True