import ctypes, sys
from ctypes import wintypes
import win32gui, win32con, commctrl

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

# Find SysListView32 child of 0x5a0258
hList = 0x4e107e
count = user32.SendMessageW(hList, commctrl.LVM_GETITEMCOUNT, 0, 0)
print(f"ListView item count: {count}")
