import ctypes, win32gui, win32process, psutil, sys
sys.stdout.reconfigure(encoding='utf-8')
user32 = ctypes.windll.user32
hdesk = user32.OpenInputDesktop(0, False, 0x01FF)
if hdesk: user32.SetThreadDesktop(hdesk)

pids = {p.pid: p.name() for p in psutil.process_iter() if any(k in p.name().lower() for k in ['vggame', 'vlbs', 'jxhelper'])}
def cb(h, _):
    _, pid = win32process.GetWindowThreadProcessId(h)
    if pid in pids and user32.IsWindowVisible(h):
        txt = win32gui.GetWindowText(h)
        rect = win32gui.GetWindowRect(h)
        print(f'{pids[pid]} (PID {pid}) -> HWND {hex(h)}: "{txt}" | Rect: {rect}')
    return True
win32gui.EnumWindows(cb, 0)
