INNER CODE UNIT · Python

hSnap

Qwejay/Qflow · main.py:268

        if hSnap == -1: return pid_map
        try:
            pe32 = WindowEngine.PROCESSENTRY32()
            pe32.dwSize = ctypes.sizeof(WindowEngine.PROCESSENTRY32)
            if ctypes.windll.kernel32.Process32First(hSnap, ctypes.byref(pe32)):
                while True:
                    try: exe_name = pe32.szExeFile.decode('gbk', 'ignore')
                    except: exe_name = pe32.szExeFile.decode('utf-8', 'ignore')
                    pid_map[pe32.th32ProcessID] = exe_name
                    if not ctypes.windll.kernel32.Process32Next(hSnap, ctypes.byref(pe32)): break
        finally:
            ctypes.windll.kernel32.CloseHandle(hSnap)
        return pid_map

    @staticmethod
    def get_window_info(hwnd, pid_map=None):
        if not hwnd: return None
        length = user32.GetWindowTextLengthW(hwnd)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…