import ctypes, win32gui
from ctypes import wintypes

user32 = ctypes.windll.user32
hdesk = user32.OpenInputDesktop(0, False, 0x01FF)
if hdesk:
    user32.SetThreadDesktop(hdesk)

hwnd = 0x8c4c02
list_controls = []
def cb(h, _):
    cls = win32gui.GetClassName(h)
    txt = win32gui.GetWindowText(h)
    rect = win32gui.GetWindowRect(h)
    if "list" in cls.lower() or "syslist" in cls.lower():
        print(f"List control: HWND {hex(h)} Class: {cls} Rect: {rect}")
        list_controls.append(h)
    return True

win32gui.EnumChildWindows(hwnd, cb, None)
