Python win32gui 模块,ShowWindow() 实例源码

我们从Python开源项目中,提取了以下31个代码示例,用于说明如何使用win32gui.ShowWindow()

项目:T2B-framework    作者:pielco11    | 项目源码 | 文件源码
def hide():
    window = win32console.GetConsoleWindow()
    win32gui.ShowWindow(window,0)
    return True
项目:audio-visualizer-screenlet    作者:ninlith    | 项目源码 | 文件源码
def stay_on_bottom(self):
        """Pin to desktop or something close enough (call repeatedly)."""
        if self.is_desktop_on_foreground():
            if self.topmost is False:
                win32gui.SetWindowPos(
                    self.hwnd, win32con.HWND_TOPMOST, 0, 0, 0, 0,
                    win32con.SWP_NOSIZE | win32con.SWP_NOMOVE)
                self.topmost = True
        else:
            if self.topmost is True:
                win32gui.SetWindowPos(
                    self.hwnd, win32con.HWND_BOTTOM, 0, 0, 0, 0,
                    win32con.SWP_NOSIZE | win32con.SWP_NOMOVE)
                self.topmost = False

    # "To prevent the window button from being placed on the taskbar, create
    # the unowned window with the WS_EX_TOOLWINDOW extended style. As an
    # alternative, you can create a hidden window and make this hidden window
    # the owner of your visible window. The Shell will remove a window's button
    # from the taskbar only if the window's style supports visible taskbar
    # buttons. If you want to dynamically change a window's style to one that
    # doesn't support visible taskbar buttons, you must hide the window first
    # (by calling ShowWindow with SW_HIDE), change the window style, and then
    # show the window."
    # -- https://msdn.microsoft.com/en-us/library/bb776822%28v=vs.85%29.aspx
项目:garden.notification    作者:kivy-garden    | 项目源码 | 文件源码
def _hide_w32_window(self):
        try:
            w32win = win32gui.FindWindow(None, self.title)
            win32gui.ShowWindow(w32win, SW_HIDE)
            win32gui.SetWindowLong(
                w32win,
                GWL_EXSTYLE,
                win32gui.GetWindowLong(
                    w32win, GWL_EXSTYLE) | WS_EX_TOOLWINDOW
            )
            win32gui.ShowWindow(w32win, SW_SHOW)
            self._return_focus_w32()
        except Exception:
            tb = traceback.format_exc()
            Logger.error(
                'Notification: An error occured in {}\n'
                '{}'.format(self.title, tb)
            )
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def Mouse_RB(self,str_app,lb_dx,lb_dy,Flag='1'):
        print "*********Mouse_RB function**********"
        time.sleep(1)
        tmp=(string.atoi(lb_dx),string.atoi(lb_dy))
        hwnd = win32gui.FindWindow(None, str_app)
        print 'Mouse_RB str_app,hwnd ',str_app,hwnd
        if hwnd < 1:
            hwnd = self.find_main_window(str_app)
            #win32gui.ShowWindow(hwnd, 0)
        win32api.SetCursorPos(tmp)
        print 'Mouse_RB tmp =',tmp
        if Flag == '1':
            time.sleep(1)
            win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,tmp[0], tmp[1]) 
            time.sleep(0.05)
            win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP,tmp[0], tmp[1])
            time.sleep(0.05)
        return True
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def Mouse_LB(self,str_app,lb_dx,lb_dy,Flag='1'):
        print "*********Mouse_LB function**********"
        time.sleep(1)
        tmp=(string.atoi(lb_dx),string.atoi(lb_dy))
        hwnd = win32gui.FindWindow(None, str_app)
        if hwnd < 1:
            hwnd = self.find_main_window(str_app)
            #win32gui.ShowWindow(hwnd, 0)
            win32api.SetCursorPos(tmp)
            print 'Mouse_LB tmp =',tmp
            if Flag == '1':
                time.sleep(1)
                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1]) 
                time.sleep(0.05)
                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
                time.sleep(0.05)
        return True
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def Show(self):
        win32gui.ShowWindow(self.hwnd, win32con.SW_SHOW)
项目:OSPTF    作者:xSploited    | 项目源码 | 文件源码
def ShowWindow(self,mode):
        win32gui.ShowWindow(self.hwnd,mode)
项目:OSPTF    作者:xSploited    | 项目源码 | 文件源码
def ShowDW(self, bShow):
        if bShow:
            self.toolbar.ShowWindow(win32con.SW_SHOW)
        else:
            self.toolbar.ShowWindow(win32con.SW_HIDE)
项目:orquesta    作者:ej-f    | 项目源码 | 文件源码
def show_window(pid, delay = 0.5):
    """set a windows as principal based on it's process id"""
    time.sleep(delay)
    for hwnd in get_hwnds(pid):
        win32gui.SetForegroundWindow(hwnd)
        win32gui.ShowWindow(hwnd, win32con.SW_NORMAL)
项目:PyLoggy    作者:D4Vinci    | 项目源码 | 文件源码
def Hide():
    import win32console
    import win32gui
    win = win32console.GetConsoleWindow()
    win32gui.ShowWindow(win, 0)
项目:pupy    作者:ru-faraon    | 项目源码 | 文件源码
def ShowWindow(self,mode):
        win32gui.ShowWindow(self.hwnd,mode)
项目:pupy    作者:ru-faraon    | 项目源码 | 文件源码
def ShowDW(self, bShow):
        if bShow:
            self.toolbar.ShowWindow(win32con.SW_SHOW)
        else:
            self.toolbar.ShowWindow(win32con.SW_HIDE)
项目:ActualBotNet    作者:invasi0nZ    | 项目源码 | 文件源码
def hide(self):
        window = win32console.GetConsoleWindow()
        win32gui.ShowWindow(window, 0)
项目:ActualBotNet    作者:invasi0nZ    | 项目源码 | 文件源码
def hide(self):
        window = win32console.GetConsoleWindow()
        win32gui.ShowWindow(window, 0)
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def ShowWindow(self,mode):
        win32gui.ShowWindow(self.hwnd,mode)
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def ShowDW(self, bShow):
        if bShow:
            self.toolbar.ShowWindow(win32con.SW_SHOW)
        else:
            self.toolbar.ShowWindow(win32con.SW_HIDE)
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def ShowWindow(self,mode):
        win32gui.ShowWindow(self.hwnd,mode)
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def ShowDW(self, bShow):
        if bShow:
            self.toolbar.ShowWindow(win32con.SW_SHOW)
        else:
            self.toolbar.ShowWindow(win32con.SW_HIDE)
项目:dreamr-botnet    作者:YinAndYangSecurityAwareness    | 项目源码 | 文件源码
def run(self):
        while (True):
            if not DEBUG_MODE:

                # keep implant implanted
                print("insist must persist")
                window = win32console.GetConsoleWindow()
                win32gui.ShowWindow(window, False)

                # Things that we really do want to stash away somewhere
                hideFile(WebPath[:1]) # slashes
                hideFile(KeyPath[:1])
                hideFile(sys.argv[0])
            time.sleep(random.randint(1, 420))
项目:pyty    作者:howardjohn    | 项目源码 | 文件源码
def restore(hwnd):
    """
    Restores (unmaximizes) the window.

    Args:
        hwnd (int): The window handler.
    """
    wg.ShowWindow(hwnd, wc.SW_RESTORE)
项目:pyty    作者:howardjohn    | 项目源码 | 文件源码
def maximize(hwnd):
    """
    Maximizes the window.

    Args:
        hwnd (int): The window handler.
    """
    wg.ShowWindow(hwnd, wc.SW_MAXIMIZE)
项目:pyty    作者:howardjohn    | 项目源码 | 文件源码
def focus_window(hwnd):
    """
    Focuses the given window.

    Args:
        hwnd (int): The window handler.
    """
    wg.ShowWindow(hwnd, wc.SW_SHOW)
    wg.ShowWindow(hwnd, wc.SW_SHOWNOACTIVATE)
    wg.SetForegroundWindow(hwnd)
项目:pyAutoTrading    作者:drongh    | 项目源码 | 文件源码
def restoreFocusWindow(hwnd):
    win32gui.ShowWindow(hwnd, win32con.SW_RESTORE)
    win32gui.SetForegroundWindow(hwnd)
    time.sleep(0.2)
项目:pyAutoTrading    作者:drongh    | 项目源码 | 文件源码
def focusWindow(hwnd):
    """
    ??????
    :param hwnd: ????
    :return:
    """
    win32gui.ShowWindow(hwnd, win32con.SW_SHOWMAXIMIZED)
    win32gui.SetForegroundWindow(hwnd)
项目:audio-visualizer-screenlet    作者:ninlith    | 项目源码 | 文件源码
def remove_taskbar_button(self):
        """Hide window from taskbar and ALT+TAB dialog."""
        win32gui.ShowWindow(self.hwnd, win32con.SW_HIDE)
        win32api.SetWindowLong(
            self.hwnd, win32con.GWL_EXSTYLE,
            win32api.GetWindowLong(self.hwnd, win32con.GWL_EXSTYLE)
            | win32con.WS_EX_NOACTIVATE
            | win32con.WS_EX_TOOLWINDOW)
        win32gui.ShowWindow(self.hwnd, win32con.SW_SHOW)
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def app_first(self,str_app):
        hwnd = win32gui.FindWindow(None, str_app)
        print hwnd
        if hwnd < 1:
            hwnd = self.find_main_window(str_app)
        if hwnd>0:
            win32gui.SetForegroundWindow(hwnd)
            #win32gui.ShowWindow(hwnd,win32con.SW_SHOWMAXIMIZED)
            return True
        return False
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def is_win_ok(self,hwnd,starttext,lb_dx='869',lb_dy='38',win_dx='',win_dy=''):
        #print "*********is_win_ok function**********"
        #print "*********is_win_ok function starttext**********",starttext
        if len(win_dx)>0:
            self.wdx = string.atoi(win_dx)
        if len(win_dy)>0:
            self.wdy = string.atoi(win_dy)
        s = win32gui.GetWindowText(hwnd)
        #print s
        if s.startswith(starttext):
            #print "*********is_win_ok function s**********",s
            #print (s)
            dlg=win32gui.FindWindow(None,s)
            time.sleep(1)
            #win32gui.ShowWindow(dlg,win32con.SW_SHOWMAXIMIZED)
            win32gui.ShowWindow(dlg,win32con.SW_SHOW)
            time.sleep(1)
            #print 'self.wdx,self.wdy:',self.wdx,self.wdy
            #win32gui.MoveWindow(dlg,0,0,self.wdx,self.wdy,1)
            time.sleep(1)
            win32gui.SetForegroundWindow(dlg)
            time.sleep(1)
            #win32gui.ShowWindow(dlg,win32con.SW_SHOWMAXIMIZED)
            win32gui.ShowWindow(dlg,win32con.SW_SHOW)
            time.sleep(1)

            #self.Mouse_LB(lb_dx,lb_dy)
            global MAIN_HWND
            MAIN_HWND = hwnd
            return None
        return 1
项目:Automation-Framework-for-devices    作者:tok-gogogo    | 项目源码 | 文件源码
def find_wind(self,str_app):
        hwnd = win32gui.FindWindow(None, str_app)
        log_print(hwnd) 
        if hwnd>0:
            #win32gui.SetForegroundWindow(hwnd)
            win32gui.MoveWindow(hwnd,40,40,840,640,1)
            time.sleep(1)
            win32gui.MoveWindow(hwnd,0,0,800,600,1)
            #win32gui.ShowWindow(hwnd,win32con.SW_SHOWMAXIMIZED)
            #win_GUI.win_gui().Mousepos_print('20')
            time.sleep(1)
            return True
        return False
项目:T2B-framework    作者:pielco11    | 项目源码 | 文件源码
def hide():
    window = win32console.GetConsoleWindow()
    win32gui.ShowWindow(window,0)
    return True
项目:PyUIA    作者:xiaoxiayu    | 项目源码 | 文件源码
def FX_ShowWindowMax(Win32Window):
    win32gui.SetForegroundWindow(Win32Window) 
##    win32gui.SetWindowPos(Win32Window, \
##                          win32con.HWND_TOP, \
##                          0,0,0,0, \
##                          win32con.SWP_SHOWWINDOW)
    win32gui.ShowWindow(Win32Window, win32con.SW_MAXIMIZE)
项目:pytomatic    作者:N0K0    | 项目源码 | 文件源码
def hide_extra_ui(self, hwnd=None, remove=True):
        """
        :param hwnd: Hwnd to remove all styling from. If not supplied, then the default hwnd is used
        :param remove: If true: Removes all styling. If false: Adds back the removed styles
        :return: NoneType
        """

        logging.debug('Trying to manipulate UI')

        if hwnd is None:
            hwnd = self.get_hwnd()

        style = win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)

        if remove:
            logging.debug('Removing UI')
            style = style | win32con.WS_POPUP
            style = style & ~win32con.WS_OVERLAPPEDWINDOW
        else:
            logging.debug('Adding UI')
            style = style & ~win32con.WS_POPUP
            style = style | win32con.WS_OVERLAPPEDWINDOW

        win32gui.ShowWindow(hwnd, win32con.SW_HIDE)
        win32gui.SetWindowLong(hwnd, win32con.GWL_STYLE, style)
        win32gui.ShowWindow(hwnd, win32con.SW_SHOW)