def EnumWindowsHandler2(hwnd, extra): if win32gui.GetWindowTextLength(hwnd) != 0 and \ win32gui.IsWindowEnabled(hwnd) and \ win32gui.IsWindowVisible(hwnd) and \ win32gui.GetWindowLong(hwnd, win32con.WS_EX_TOOLWINDOW) == 0 and \ win32gui.GetParent(hwnd) == 0: extra.add((hwnd, win32gui.GetWindowText(hwnd)))
def IsOpen(self): if (self.__hwnd_main == 0 or False == win32gui.IsWindow(self.__hwnd_main) or False == (win32gui.IsWindowVisible(self.__hwnd_main) and win32gui.IsWindowEnabled(self.__hwnd_main))): return False else: return True
def EnumWindowsHandler(hwnd, extra): style = win32gui.GetWindowLong(hwnd, -16) if style & 0x10000000 == 0x10000000 and style & 0x00C00000 == 0x00C00000: if win32gui.GetWindowTextLength(hwnd) != 0: if win32gui.IsWindowVisible(hwnd) and win32gui.GetParent( hwnd) == 0: hicon = win32gui.GetClassLong(hwnd, -14) if hicon: extra.add((hwnd, win32gui.GetWindowText(hwnd)))
def window_enum_handler(hwnd, handler_param): window_process_id = win32process.GetWindowThreadProcessId(hwnd)[1] for process in handler_param["processes"]: if process.pid == window_process_id: owner_window_handle = win32gui.GetWindow(hwnd, GW_OWNER) owner_window_is_visible = win32gui.IsWindowVisible( owner_window_handle) if owner_window_is_visible: win32gui.ShowWindow(owner_window_handle, handler_param["operation"])
def callback(hwnd, hwnds): if win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd): if pid_text is not None: text = win32gui.GetWindowText(hwnd) if text.find(pid_text) >= 0: hwnds.append(hwnd) else: _, found_pid = win32process.GetWindowThreadProcessId(hwnd) if found_pid == pid: hwnds.append(hwnd) return True
def GetHWND(self, HWND): ''' Gets handle of window to view HWND: Handle of window to be captured Return: True on success; False on failure ''' if win32gui.IsWindowVisible(HWND): self.hwnd = HWND self.winLeft, self.winTop, self.winRight, self.winBottom = win32gui.GetWindowRect( self.hwnd) return True return False
def winEnumHandler( hwnd, ctx): global WindowRects; if win32gui.IsWindowVisible( hwnd ): #print(hex(hwnd), win32gui.GetWindowText( hwnd )) if (win32gui.GetWindowText(hwnd) == "RWBY Deckbuilding Game"): print(hex(hwnd), win32gui.GetWindowText( hwnd )) rect = win32gui.GetWindowRect(hwnd); winRect = [0,0,0,0] winRect[0] = rect[0] winRect[1] = rect[1] winRect[2] = rect[2] winRect[3] = rect[3] WindowRects.append(winRect);
def is_visible(self) -> bool: """ 窗口是否可见 @property {bool} """ return (win32gui.IsWindowVisible(self.handle) != 0)
def obsLikeHandler(hwnd, extra): styles = win32gui.GetWindowLong(hwnd, win32con.GWL_STYLE) exStyle = win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE) if win32gui.IsWindowVisible(hwnd) and styles & win32con.WS_CHILD == 0 and \ exStyle & win32con.WS_EX_TOOLWINDOW == 0 and win32gui.GetWindowText(hwnd) != '': extra.add((hwnd, win32gui.GetWindowText(hwnd)))
def is_active_gui(hwnd: int) -> bool: """핸들이 감지할 수 있는 GUI를 가지고 있는지\ 확인합니다.""" WindowEnabled = win32gui.IsWindowEnabled(hwnd) WindowVisible = win32gui.IsWindowVisible(hwnd) return bool(WindowEnabled and WindowVisible)
def winEnumHandler(hwnd, ctx): if win32gui.IsWindowVisible(hwnd): print(hex(hwnd), win32gui.GetWindowText(hwnd))
def getHwnd(hwnd, procid): if procid in win32process.GetWindowThreadProcessId(hwnd): if win32gui.IsWindowVisible(hwnd): self.__HWND = hwnd
def enum_handler(hwnd, args): if win32gui.IsWindowVisible( hwnd) and win32gui.GetWindowTextLength(hwnd) != 0: open_windows.append([hwnd, win32gui.GetWindowText(hwnd)])
def is_share_mouse_dim_window_visible(): return win32gui.IsWindowVisible(win32gui.FindWindow("TDimForm", None))