大家好,又见面了,我是你们的朋友全栈君。
import win32gui
class Hwnd():
def get_hwnd_dic(self, hwnd, hwnd_title):
if (win32gui.IsWindow(hwnd)
and win32gui.IsWindowEnabled(hwnd)
and win32gui.IsWindowVisible(hwnd)
and win32gui.GetWindowText(hwnd)):
hwnd_title[f"{hwnd}"] = win32gui.GetWindowText(hwnd)
def get_hwnd(self):
''' :return: {hwnd:title} '''
hwnd_title = {
}
win32gui.EnumWindows(self.get_hwnd_dic, hwnd_title)
return hwnd_title
hwnd = Hwnd()
print(hwnd.get_hwnd())
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/162523.html原文链接:https://javaforall.cn