think i found the solution , will merge it in later. tested and seems to work.
if there’s no parent handle, (0) it’s the main window
parent_hwnd = ctypes.windll.user32.GetParent(win.hwnd)
if parent_hwnd == 0:
blender_windows = [win]
break