コード例 #1
0
ファイル: login_qq_cli.py プロジェクト: lonehand/save_code
def QQ(qq, pwd):
    # a = win32gui.FindWindow(None, "QQ")
    # 运行QQ
    os.system('"E:\\Program Files (x86)\\Tencent\\TIM\\Bin\\QQScLauncher.exe"')
    time.sleep(5)
    a = win32gui.FindWindow(None, "TIM")  # 获取窗口的句柄,参数1: 类名,参数2: 标题QQ
    loginid = win32gui.GetWindowPlacement(a)
    windll.user32.SetCursorPos(loginid[4][0] + 300, loginid[4][1] + 273)
    pag.click()
    time.sleep(0.2)
    # 输入账号
    pag.typewrite(qq)
    time.sleep(0.2)
    # tab切换
    pag.hotkey('tab')
    pag.typewrite(pwd)
    # 点击回车键登录
    pag.hotkey('enter')
    time.sleep(4)
    a = win32gui.FindWindow(None, "TIM")  # 获取窗口的句柄,参数1: 类名,参数2: 标题QQ
    loginid = win32gui.GetWindowPlacement(a)
    pag.click(loginid[4][2] - 68, loginid[4][1] + 29)
    print(68, 29)
    """<span class="err_m" id="err_m">为了更好的保护您的QQ,请使用<a href="http://im.qq.com/mobileqq/2013/" target="_blank">QQ手机版</a>扫描二维码登录。<a href="http://ptlogin2.qq.com/qq_cheat_help" target="_blank">(帮助反馈)</a>(10005)</span>"""
    """
コード例 #2
0
 def getInnerHandle(self, handle):
     # cannot get the correct "inner handle"
     return
     nextHndle = handle
     user32 = ctypes.windll.user32
     #
     controls = mf.findControls(handle, wantedClass="Scintilla")
     print 'Scintilla controls: %s' % controls
     for c in controls:
         ln = self.getCurrentLineNumber(c)
         numberLines = self.getNumberOfLines(c)
         visible1 = self.isVisible(c)
         info = win32gui.GetWindowPlacement(c)
         print 'c: %s, linenumber: %s, nl: %s, info: %s' % (
             c, ln, numberLines, repr(info))
         parent = c
         while 1:
             parent = win32gui.GetParent(parent)
             clName = win32gui.GetClassName(parent)
             visible = self.isVisible(parent)
             info = win32gui.GetWindowPlacement(parent)
             print 'parent: %s, class: %s, visible: %s, info: %s' % (
                 parent, clName, visible, repr(info))
             if parent == handle:
                 print 'at top'
                 break
コード例 #3
0
def QQ(qq, pwd):
    # a = win32gui.FindWindow(None, "QQ")
    # 运行QQ
    os.system('"%s"' % ExecutePaths.TimPath)
    time.sleep(5)
    a = win32gui.FindWindow(None, "TIM")  # 获取窗口的句柄,参数1: 类名,参数2: 标题QQ
    loginid = win32gui.GetWindowPlacement(a)
    windll.user32.SetCursorPos(loginid[4][0] + 300, loginid[4][1] + 273)
    pag.click()
    time.sleep(0.2)
    # 输入账号
    pag.typewrite(qq)
    time.sleep(0.2)
    # tab切换
    pag.hotkey('tab')
    pag.typewrite(pwd)
    # 点击回车键登录
    pag.hotkey('enter')
    time.sleep(3)
    pag.screenshot(after_enter_login_btn)
    # 判断是否出现验证码   (90,135)
    res = handle_login_res(loginid)
    if not res:
        return False
    pag.hotkey('enter')
    time.sleep(4)
    a = win32gui.FindWindow(None, "TIM")  # 获取窗口的句柄,参数1: 类名,参数2: 标题QQ
    loginid = win32gui.GetWindowPlacement(a)
    pag.click(loginid[4][2] - 68, loginid[4][1] + 29)
    # print(68, 29)
    return True
コード例 #4
0
def qq_login():
    # TODO: 可以将密码账户作为参数传入
    # 运行QQ
    os.system('"C:\Program Files (x86)\Tencent\QQLite\Bin\QQScLauncher.exe"')
    time.sleep(5)
    a = win32gui.FindWindow(None, "QQ")  # 获取窗口的句柄,参数1: 类名,参数2: 标题QQ
    login_id = win32gui.GetWindowPlacement(a)
    windll.user32.SetCursorPos(login_id[4][0] + 300, login_id[4][1] + 273)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)  # 按下鼠标
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)  # 放开鼠标
    time.sleep(0.2)
    # 输入账号
    # pyautogui.typewrite(["1", "4", "1", "4", "7", "1", "0", "8", "2", "3"])
    pyautogui.typewrite("1414710823")
    time.sleep(1)

    # tab切换
    win32api.keybd_event(9, 0, 0, 0)
    win32api.keybd_event(9, 0, win32con.KEYEVENTF_KEYUP, 0)
    # pyautogui.typewrite(["L", "J", "H", "-", "l", "j", "h", "@", "1", "6", "9", "9", "1", "4", "@"])
    pyautogui.typewrite("LJH-ljh@169914@")
    time.sleep(1)

    # 点击回车键登录
    win32api.keybd_event(13, 0, 0, 0)
    win32api.keybd_event(13, 0, win32con.KEYEVENTF_KEYUP, 0)
    time.sleep(3)
コード例 #5
0
ファイル: utils.py プロジェクト: fryougi/farmbot
 def __init__(self, app='blue'):
     self.app = app
     # find window by name
     if self.app == 'blue':
         self.hwnd = win32gui.FindWindow(None, "BlueStacks")
     if self.hwnd == 0:
         self.rect = (50, 50, 900, 500)
     else:
         if app == 'blue':
             # resize window because bluestacks is dumb about resolution
             x0, y0, x1, y1 = win32gui.GetWindowRect(self.hwnd)
             win32gui.MoveWindow(self.hwnd, x0, y0, 1285, 764, True)
         self.rect = win32gui.GetWindowPlacement(self.hwnd)[-1]
     self.xres = win32api.GetSystemMetrics(0)
     self.yres = win32api.GetSystemMetrics(1)
     # FGO Screen is 640x360 (16:9 ratio)
     # (originally developed for samsung smart view)
     if app == 'blue':
         # Just have horizontal bluestacks
         self.xleft = 2
         self.ytop = 42
         self.xtol = 1280
         self.ytol = 720
     # set valid cursor locations
     self.xmin = self.rect[0] + self.xleft
     self.xmax = self.xmin + self.xtol
     self.ymin = self.rect[1] + self.ytop
     self.ymax = self.ymin + self.ytol
コード例 #6
0
    def loginQQ(self):
        qq = self.account['qq']
        pwd = self.account['pwd']
        # 运行QQ
        os.system(QQ_PATH)
        time.sleep(5)
        # 获取QQ的窗口句柄
        # 参数1是类名,参数2是QQ软件的标题
        a = win32gui.FindWindow(None, "QQ")
        # 获取QQ登录窗口的位置
        loginid = win32gui.GetWindowPlacement(a)
        #print(loginid)
        #print(loginid[4][0])
        #print(loginid[4][1])

        # 定义一个键盘对象
        k = PyKeyboard()

        # 把鼠标放置到登陆框的输入处
        windll.user32.SetCursorPos(loginid[4][0] + 192, loginid[4][1] + 245)

        # 按下鼠标再释放
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0,
                             0)  # press mouse
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0,
                             0)  # release mouse

        time.sleep(2)
        ###input username
        # 输入用户名
        k.type_string(qq)
        time.sleep(0.5)
        ##tab
        # 按下tab,切换到输入密码的地方
        win32api.keybd_event(9, 0, 0, 0)
        win32api.keybd_event(9, 0, win32con.KEYEVENTF_KEYUP, 0)
        # 按下tab用下面两行也行
        # k.press_key(k.tab_key)
        # k.release_key(k.tab_key)
        # 按下tab用下面一行也行
        # k.tap_key(k.tab_key)

        # 输入密码
        k.type_string(pwd)
        time.sleep(0.5)

        # 按下回车
        win32api.keybd_event(13, 0, 0, 0)
        win32api.keybd_event(13, 0, win32con.KEYEVENTF_KEYUP, 0)

        # 最小化没啥用
        Minimize = win32gui.GetForegroundWindow()  # 获取窗口句柄
        win32gui.ShowWindow(Minimize, win32con.SW_MINIMIZE)  # 最小化
        self.state = 1

        time.sleep(2)

        self.setPInfo(self.mgr.getANewPid())

        return True
コード例 #7
0
 def was_maximized(self):
     """Indicate whether the window was maximized before minimizing or not"""
     if self.handle:
         (flags, _, _, _, _) = win32gui.GetWindowPlacement(self.handle)
         return (flags & win32con.WPF_RESTORETOMAXIMIZED == win32con.WPF_RESTORETOMAXIMIZED)
     else:
         return None
コード例 #8
0
ファイル: main.py プロジェクト: electroheart-gh/MyTaskBoard
    def on_touch_up(self, touch):
        """Return true when the touch collides me.

        It is because only one task window should be activated at one time."""

        super().on_touch_up(touch)
        if self.collide_point(*touch.pos):
            if touch.is_mouse_scrolling:
                # Nothing to do for future use
                pass
            elif touch.opos == touch.pos:
                # If it is _click_, make it foreground regardless of the window state
                placement = win32gui.GetWindowPlacement(self.window_handle)
                # print("placement: ", placement)
                if placement[1] & SW_SHOWMINIMIZED:
                    if placement[0] & WPF_RESTORETOMAXIMIZED:
                        # Before minimized, it was maximized
                        win32gui.ShowWindow(self.window_handle,
                                            win32con.SW_MAXIMIZE)
                    else:
                        # Before minimized, it was not maximized
                        win32gui.ShowWindow(self.window_handle,
                                            win32con.SW_RESTORE)
                win32gui.SetForegroundWindow(self.window_handle)
            return True
        else:
            return False
コード例 #9
0
ファイル: eftMaps.py プロジェクト: WrightTrae/tarkov-novichok
def readScreen():
    if windowHwnd:
        tup = win32gui.GetWindowPlacement(windowHwnd)
        minimized = True
        if tup[1] == win32con.SW_SHOWMAXIMIZED:
            minimized = False
        elif tup[1] == win32con.SW_SHOWMINIMIZED:
            minimized = True
        elif tup[1] == win32con.SW_SHOWNORMAL:
            minimized = False

        if not minimized:
            windowSize = win32gui.GetWindowRect(windowHwnd)
            cap = ImageGrab.grab(windowSize)

            # Raid Status
            parseRaidStatus(cap, windowSize)

            global status
            if status == const.RAID_PREPARE:
                # Map Name
                parseMapName(cap, windowSize)

            elif status == const.IN_RAID:
                spotifyControl.pauseSpotify()

            elif status == const.RAID_ENDED:
                spotifyControl.playSpotify()
                offlinePath = getImagePath('ammo')
                global currentMapImg
                if offlinePath != currentMapImg:
                    openMapImage(offlinePath)
                    currentMapImg = offlinePath
コード例 #10
0
def talk(h):
    a = win32gui.GetWindowPlacement(h)  # 获取位置信息
    if len(a) == 5:
        rect = a[4]
        startX = rect[0]
        startY = rect[1]
        endX = rect[2]
        endY = rect[3]
        print(startX, startY, endX, endY)
        m_posX = startX + (endX - startX) / 4
        m_posY = endY - 15
        autopy.mouse.smooth_move(m_posX, m_posY)
        windowToTop(h)
        # utils.MouseAndKeyboardUtils.mouse_dclick(m_posX, m_posY)
        # str = 'hello'
        # utils.MouseAndKeyboardUtils.key_input(str)
    # 模拟按下上键
    time.sleep(0.5)
    win32api.keybd_event(0x26, 0, 0, 0)
    print("up down")
    win32api.keybd_event(0x26, 0, win32con.KEYEVENTF_KEYUP, 0)
    print("up up")
    # 模拟按下回车键
    win32api.keybd_event(0x0D, 0, 0, 0)
    print("enter down")
    win32api.keybd_event(0x0D, 0, win32con.KEYEVENTF_KEYUP, 0)
    print("enter up")
コード例 #11
0
def qq_login(qq, pwd):
    os.system('"C:\Program Files (x86)\Tencent\QQ\Bin\QQScLauncher.exe"')
    time.sleep(3)
    a = win32gui.FindWindow(None, "QQ")  #获取窗口的句柄,参数1:类名,参数2:标题
    loginid = win32gui.GetWindowPlacement(a)
    windll.user32.SetCursorPos(loginid[4][0] + 211,
                               loginid[4][1] + 247)  #置鼠标的位置
    # print(loginid)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)  #按下鼠标左键
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)  #松开鼠标左键
    time.sleep(3)
    k = PyKeyboard()
    k.type_string(qq)  #输入QQ号码
    time.sleep(3)
    win32api.keybd_event(9, 0, 0, 0)  #按下Tab键
    win32api.keybd_event(9, 0, win32con.KEYEVENTF_KEYUP, 0)  #松开Tab键
    time.sleep(3)
    k.type_string(pwd)  #输入QQ密码
    # print(pwd)
    time.sleep(3)
    win32api.keybd_event(13, 0, 0, 0)  #按下Enter键
    win32api.keybd_event(13, 0, win32con.KEYEVENTF_KEYUP, 0)  #松开Enter键
    qstr = 3 * "*" + qq[3:]
    print('{}登录成功'.format(qstr))
    time.sleep(6)
コード例 #12
0
def changeCallback(type, args):
    global messWindow
    # not active without special version of natlinkmain,
    # call the cancelMode, to switch off exclusive mode when mic toggles:
    # try to find the messages window at each mic on and minimize if found:
    if type == 'mic' and args == 'on':
        if testMode: return  # only in production mode...
        #print 'mic on, messWindow: %s'% messWindow
        if messWindow:
            try:
                title = win32gui.GetWindowText(messWindow)
                if title != messTitle:
                    print('title does not match: actual: |%s|, wanted: |%s|' %
                          (title, messTitle))
                    messWindow = None
            except:
                messWindow = None
        if not messWindow:
            messWindows = mess.findTopWindows(
                wantedText="Messages from Python Macros")
            if messWindows:
                messWindow = messWindows[0]
        if not messWindow:
            print('didnt find messages window')
            return
        #toMin = win32con.SW_MINIMIZE
        toMin = win32con.SW_SHOWMINIMIZED
        info = list(win32gui.GetWindowPlacement(messWindow))
        #print 'info1: %s, SW_SHOWMINIMIZED: %s'% (info[1], toMin)
        info[1] = toMin
        win32gui.SetWindowPlacement(messWindow, tuple(info))
コード例 #13
0
ファイル: handle.py プロジェクト: Wall-ee/WeChatPC
 def get_handle_rect(self):
     """获取句柄矩形"""
     # abs_position = win32gui.GetWindowRect(self.handle)[:2]
     abs_position = win32gui.GetWindowPlacement(self.handle)[-1][:2]
     handle_shape = win32gui.GetClientRect(self.handle)[2:]
     # print(abs_position, handle_shape)
     return abs_position + handle_shape
コード例 #14
0
 def get_placement(self, hndl):
     """
     Retrieve the window placement in the desktop.
     @see: L{set_placement}
     @rtype:  L{win32.WindowPlacement}
     @return: Window placement in the desktop.
     """
     return win32gui.GetWindowPlacement(hndl)
コード例 #15
0
ファイル: findGameWindow.py プロジェクト: veldrin23/R2D3
 def callback(hWnd, windows):
     if not isRealWindow(hWnd):
         return
     rect = win32gui.GetWindowRect(hWnd)
     name = win32gui.GetWindowText(hWnd)
     placement = win32gui.GetWindowPlacement(hWnd)
     windows.append((name, (placement[4][0], placement[4][1]),
                     (rect[2] - rect[0], rect[3] - rect[1]), hWnd))
コード例 #16
0
ファイル: temp.delete.py プロジェクト: NWalker4483/Android-CV
    def read_local_screen(self):
        self.window = winGuiAuto.findTopWindow("NoxPlayer")
        win32gui.SetWindowPos(self.window, win32con.HWND_TOPMOST, 0, 0, 0, 0,
                              win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)
        rect = win32gui.GetWindowPlacement(self.window)[-1]
        self.screen = np.array(ImageGrab.grab(rect))

        pass
コード例 #17
0
def capture():
    file_name = os.path.join(capture_save_path, '{}.jpg'.format(int(time.time())))
    # 获取屏幕最大尺寸,即桌面尺寸
    hwnd = win32gui.GetDesktopWindow()
    window_capture(file_name, win32gui.GetWindowPlacement(hwnd)[4])
    time.sleep(1)
    # 用 系统默认 看图软件 打开
    os.system(file_name)
コード例 #18
0
def windowEnumerationHandler(hwnd, top_windows):
    if win32gui.IsWindowVisible(hwnd) and not win32gui.IsIconic(hwnd):
        if (win32gui.GetWindowText(hwnd) != ''):
            top_windows.append((hwnd, win32gui.GetWindowText(hwnd)))
            ss = win32gui.GetWindowPlacement(hwnd)
            if (ss[4][0] < 0):
                second_monitor.append((hwnd, ss[4]))
            else:
                main_monitor.append((hwnd, ss[4]))
コード例 #19
0
ファイル: window.py プロジェクト: fans656/quick-console
 def activate(self):
     logger.info(u'activate "{}"'.format(self.title))
     hwnd = self.hwnd
     _, showCmd, _, _, _ = win32gui.GetWindowPlacement(hwnd)
     minimized = showCmd == win32con.SW_SHOWMINIMIZED
     cmdShow = win32con.SW_RESTORE if minimized else win32con.SW_SHOW
     win32gui.ShowWindow(hwnd, cmdShow)
     win32gui.SetForegroundWindow(hwnd)
     self.status = max(Switched, self.status)
コード例 #20
0
 def __open_window(self):
     """
     获取窗口信息
     """
     # 获取QQ的窗口句柄
     a = win32gui.FindWindow(None, self.__name)
     # 获取QQ登录窗口的位置
     loginid = win32gui.GetWindowPlacement(a)
     return loginid
コード例 #21
0
    def goToWindow(self, hwnd):
        windowPlacement = win32gui.GetWindowPlacement(hwnd)
        showCmd = windowPlacement[1]

        if showCmd == SW_RESTORE:
            win32gui.ShowWindow(hwnd, SW_RESTORE)
        else:
            win32gui.BringWindowToTop(hwnd)

        win32gui.SetForegroundWindow(hwnd)
        win32gui.SetActiveWindow(hwnd)
コード例 #22
0
def window_location():
    """Finds the location of the League window on the desktop"""
    try:
        league_win = winGuiAuto.findTopWindow("League of Legends")
    except:
        return None
    if win32gui.IsWindowVisible(league_win) and not win32gui.IsIconic(league_win):
        win_loc = win32gui.GetWindowPlacement(league_win)[-1]
        return win_loc
    else:
        return None
コード例 #23
0
    def _goToWindow(self, hwnd):
        # Bascially copied from old Go-Y plugin

        windowPlacement = win32gui.GetWindowPlacement(hwnd)
        showCmd = windowPlacement[1]

        if showCmd == SW_RESTORE:
            win32gui.ShowWindow(hwnd, SW_RESTORE)
        else:
            win32gui.BringWindowToTop(hwnd)
        win32gui.SetForegroundWindow(hwnd)
        win32gui.SetActiveWindow(hwnd)
コード例 #24
0
 def screenshot(window_title=None):
     if window_title:
         hwnd = win32gui.FindWindow(None, window_title)
         if hwnd:
             if win32gui.IsWindowVisible(
                     hwnd) and win32gui.GetWindowPlacement(hwnd)[1] != 2:
                 rect = win32gui.GetWindowRect(hwnd)
                 screenshot = getRectAsImage(rect)
                 return screenshot
     else:
         screenshot = getScreenAsImage()
         return screenshot
コード例 #25
0
ファイル: windows.py プロジェクト: kazarin1alex/lit
def gotold(hwnd):
    if not win32gui.IsWindow(hwnd):
        return

    _, showCmd, _, _, _ = win32gui.GetWindowPlacement(hwnd)

    if showCmd == SW_SHOWMINIMIZED:
        win32gui.ShowWindow(hwnd, SW_RESTORE)
    else:
        win32gui.ShowWindow(hwnd, SW_SHOW)

    win32gui.SetForegroundWindow(hwnd)
    win32gui.SetActiveWindow(hwnd)
コード例 #26
0
ファイル: wx_test.py プロジェクト: haixingdev/wxnews-git
def clean_left(whand):
    std = Image.open('wxicon.bmp')
    r = (config.wx_icon_pos_x, config.wx_icon_pos_y, config.wx_icon_width + config.wx_icon_pos_x, config.wx_icon_pos_y + config.wx_icon_height)
    pos = win32gui.GetWindowPlacement(whand)[4]
    t = (r[0] + pos[0], r[1] + pos[1], r[2] + pos[0], r[3] + pos[1])
    img = ImageGrab.grab(t)
    # img.show()
    while is_similar(std, ImageGrab.grab(t)) < 0.9:
        wm.mouserClickPos((t[0], t[1]))
        wm.mouseMove((10, 5))
        time.sleep(0.5)
        wm.mouselClick()
    wm.mouselClickPos((t[0], t[1]))
コード例 #27
0
def window_tracking(coordinate):

    hwnd = win32gui.FindWindow(None, "osu!")
    window_pos = win32gui.GetWindowPlacement(hwnd)
    # Logic to isolate the X and Y
    window_pos = window_pos[4]
    window_start_x = window_pos[0]
    window_start_y = window_pos[1]

    if coordinate == 'x':
        return window_start_x
    if coordinate == 'y':
        return window_start_y
コード例 #28
0
ファイル: windows.py プロジェクト: sklprogs/shared
 def activate(self, handle=''):
     ''' It is important to choose the right flag, the window may not
         be shown otherwise.
     '''
     if win32gui.IsIconic(handle):
         win32gui.ShowWindow(handle, win32con.SW_RESTORE)
     elif win32gui.GetWindowPlacement(handle)[1] in (
             win32con.SW_SHOWMAXIMIZED, win32con.SW_MAXIMIZE):
         win32gui.ShowWindow(handle, win32con.SW_MINIMIZE)
         win32gui.ShowWindow(handle, win32con.SW_RESTORE)
     else:
         win32gui.ShowWindow(handle, win32con.SW_SHOW)
     win32gui.SetForegroundWindow(handle)
コード例 #29
0
def setMousePositonByHwn(h):
    # win32gui.SetWindowPos(h,0,0,0,0,0,win32con.SWP_NOSIZE|win32con.SWP_NOZORDER) #移动到0(0,0)位置
    a = win32gui.GetWindowPlacement(h)  # 获取位置信息
    if len(a) == 5:
        rect = a[4]
        startX = rect[0]
        startY = rect[1]
        endX = rect[2]
        endY = rect[3]
        print(startX, startY, endX, endY)
        m_posX = startX + (endX - startX) / 2
        m_posY = startY + (endY - startY) / 2
        utils.MouseAndKeyboardUtils.mouse_dclick(m_posX, m_posY)
コード例 #30
0
 def close_top_window(self, hwnd, _):
     """Close all top-level windows"""
     keep_titles = ['Start']
     keep_classes = ['ConsoleWindowClass', 'Windows.UI.Core.CoreWindow']
     keep_exes = ['explorer.exe', 'cmd.exe', 'teamviewer.exe']
     try:
         import win32api
         import win32con
         import win32event
         import win32gui
         import win32process
         import psutil
         if win32gui.IsWindowVisible(hwnd):
             window_title = win32gui.GetWindowText(hwnd)
             window_class = win32gui.GetClassName(hwnd)
             _, proccess_id = win32process.GetWindowThreadProcessId(hwnd)
             exe = os.path.basename(
                 psutil.Process(proccess_id).exe()).lower()
             if len(window_title) and \
                     window_title not in keep_titles and \
                     window_class not in keep_classes and \
                     exe not in keep_exes:
                 placement = win32gui.GetWindowPlacement(hwnd)
                 left, top, right, bottom = win32gui.GetWindowRect(hwnd)
                 width = abs(right - left)
                 height = abs(bottom - top)
                 if width > 0 and height > 0 and \
                         top >= 0 and left >= 0 and \
                         placement[1] != win32con.SW_SHOWMINIMIZED and \
                         placement[1] != win32con.SW_MINIMIZE and \
                         placement[1] != win32con.SW_FORCEMINIMIZE:
                     logging.debug(
                         "Closing Window: %s (%s) : %d,%d %dx%d : %d - %s",
                         window_title, window_class, left, top, width,
                         height, placement[1], exe)
                     handle = win32api.OpenProcess(
                         win32con.PROCESS_TERMINATE | win32con.SYNCHRONIZE
                         | win32con.PROCESS_QUERY_INFORMATION, 0,
                         proccess_id)
                     win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
                     if handle:
                         result = win32event.WaitForSingleObject(
                             handle, 10000)
                         if result == win32event.WAIT_TIMEOUT:
                             logging.debug(
                                 "Terminating process for: %s (%s)",
                                 window_title, window_class)
                             win32api.TerminateProcess(handle, 0)
                         win32api.CloseHandle(handle)
     except Exception:
         pass