import ctypes
import ctypes.wintypes

user32 = ctypes.windll.user32

def inspect():
    def cb(hwnd, extra):
        pid = ctypes.c_ulong()
        user32.GetWindowThreadProcessId(hwnd, ctypes.byref(pid))
        if pid.value == 6712:
            title = ctypes.create_unicode_buffer(512)
            user32.GetWindowTextW(hwnd, title, 512)
            cls = ctypes.create_unicode_buffer(256)
            user32.GetClassNameW(hwnd, cls, 256)
            vis = user32.IsWindowVisible(hwnd)
            print(f"HWND: {hex(hwnd)}, Title: '{title.value}', Class: '{cls.value}', Visible: {vis}")
        return True

    WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.wintypes.HWND, ctypes.wintypes.LPARAM)
    user32.EnumWindows(WNDENUMPROC(cb), 0)

if __name__ == "__main__":
    inspect()
