INNER CODE UNIT · Python

get_window_rect

Qwejay/Qflow · main.py:300

    def get_window_rect(hwnd):
        try:
            rect = ctypes.wintypes.RECT()
            if ctypes.windll.dwmapi.DwmGetWindowAttribute(hwnd, 9, ctypes.byref(rect), ctypes.sizeof(rect)) == 0:
                return Box(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top)
        except: pass
        rect = ctypes.wintypes.RECT()
        if user32.GetWindowRect(hwnd, ctypes.byref(rect)):
            return Box(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top)
        return None

    @staticmethod
    def is_window_valid_target(hwnd, my_pid):
        if not user32.IsWindowVisible(hwnd): return False
        if user32.IsIconic(hwnd): return False
        if user32.GetWindow(hwnd, 4) != 0: return False
        is_cloaked = ctypes.c_int(0)
        ctypes.windll.dwmapi.DwmGetWindowAttribute(hwnd, 14, ctypes.byref(is_cloaked), ctypes.sizeof(is_cloaked))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…