python遍历所有窗体并打印标题

2022-05-14 13:09:07 浏览数 (3)

//pip install pywin32 def foo(hwnd,mouse):

去掉下面这句就所有都输出了,但是我不需要那么多

if IsWindow(hwnd) and IsWindowEnabled(hwnd) and IsWindowVisible(hwnd): titles.add(GetWindowText(hwnd)) EnumWindows(foo, 0) lt = [t for t in titles if t] lt.sort() for t in lt: print(t)

1 人点赞