遍历回调函数
(self, hwnd, _)
| 101 | win32gui.SetWindowPos(hwnd, 0, wrect[0], wrect[1], wrect[2], wrect[3], win32con.SWP_NOACTIVATE) |
| 102 | |
| 103 | def _enumWindows(self, hwnd, _): |
| 104 | """遍历回调函数""" |
| 105 | if hwnd == self.myhwnd: |
| 106 | return # 防止自己嵌入自己 |
| 107 | if win32gui.IsWindow(hwnd) and win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd): |
| 108 | phwnd = win32gui.GetParent(hwnd) |
| 109 | title = win32gui.GetWindowText(hwnd) |
| 110 | name = win32gui.GetClassName(hwnd) |
| 111 | self.windowList.addItem( |
| 112 | '{0}|{1}|\t标题:{2}\t|\t类名:{3}'.format(hwnd, phwnd, title, name)) |
| 113 | |
| 114 | |
| 115 | if __name__ == '__main__': |