python3 遍历windows下 所有句柄及窗口名称 | 您所在的位置:网站首页 › 怎么看一个文件的句柄名称 › python3 遍历windows下 所有句柄及窗口名称 |
遍历windows 所有可显示的窗口句柄及窗口名称。
import win32gui hwnd_title = dict() def get_all_hwnd(hwnd,mouse): if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled(hwnd) and win32gui.IsWindowVisible(hwnd): hwnd_title.update({hwnd:win32gui.GetWindowText(hwnd)}) win32gui.EnumWindows(get_all_hwnd, 0) for h,t in hwnd_title.items(): if t is not "": print(h, t) 结果 : 1576952 mypython [D:\mypython] - ...\test.py [mypython] - PyCharm 6425832 Python 运算符 | 菜鸟教程 - Google Chrome 264212 IT学习讨论组等20个会话 2754364 无标题 - 记事本 3018460 Xshell 5 3673256 Spy++ 4264012 计算器 1903766 计算器 984780 Microsoft Edge 1313006 Microsoft Edge 396206 Microsoft Edge |
今日新闻 |
推荐新闻 |
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 |