import ctypes, sys
from ctypes import wintypes

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

hwnd = 0x5a0258

def enum_children(h):
    res = []
    def child_cb(ch, _):
        cls_buf = ctypes.create_unicode_buffer(256)
        user32.GetClassNameW(ch, cls_buf, 256)
        txt_len = user32.GetWindowTextLengthW(ch) + 1
        txt_buf = ctypes.create_unicode_buffer(txt_len)
        user32.GetWindowTextW(ch, txt_buf, txt_len)
        ctrl_id = user32.GetDlgCtrlID(ch)
        res.append((ch, ctrl_id, cls_buf.value, txt_buf.value))
        return True
    WNDENUMPROC = ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.HWND, wintypes.LPARAM)
    user32.EnumChildWindows(h, WNDENUMPROC(child_cb), 0)
    return res

for ch, cid, cls, txt in enum_children(hwnd):
    print(f'{hex(ch)} | ID: {cid} | {cls} | "{txt}"')
