Administrator
2025-05-26 cc2c7a8514d3d6eea4f73b5875c2500883d165f0
1
2
3
4
5
6
7
8
9
10
11
12
13
 
import win32gui
 
# 获取顶部窗口句柄
def get_top_window(hwnd):
    child = hwnd
    count = 50
    while True and count >= 0:
        count -= 1
        pa = win32gui.GetParent(child)
        if pa <= 0:
            return child
        child = pa