import ctypes
import sys

def main():
    hwnds = []
    def enum_windows_callback(hwnd, extra):
        pid = ctypes.c_ulong()
        ctypes.windll.user32.GetWindowThreadProcessId(hwnd, ctypes.byref(pid))
        if pid.value == 64988:
            length = ctypes.windll.user32.GetWindowTextLengthW(hwnd)
            buff = ctypes.create_unicode_buffer(length + 1)
            ctypes.windll.user32.GetWindowTextW(hwnd, buff, length + 1)
            vis = ctypes.windll.user32.IsWindowVisible(hwnd)
            hwnds.append((hwnd, hex(hwnd), buff.value, vis))
        return True

    EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.c_void_p, ctypes.c_void_p)
    ctypes.windll.user32.EnumWindows(EnumWindowsProc(enum_windows_callback), 0)
    print(f"Total windows found for PID 64988: {len(hwnds)}")
    for h, hex_h, title, vis in hwnds:
        print(f"HWND: {hex_h} ({h}) | Title: '{title}' | Visible: {vis}")

if __name__ == "__main__":
    main()
