def _window_enum_dialog_callback(hwnd, extra):
'''Call back func which checks each open window and matches the name of window using reg ex'''
#self._handle = None
matchtext = extra
matchtext = matchtext.encode('utf-8')
logging.debug("call _window_enum_dialog_callback")
classname = win32gui.GetClassName(hwnd)
title_text = win32gui.GetWindowText(hwnd)
title_text = title_text.decode('gbk').encode('utf-8')
if classname == '#32770':
matchtext = matchtext.encode('utf-8')
logging.debug("msg: " + matchtext)
logging.debug("Title is: " + title_text)
if (matchtext.strip() == title_text.strip()):
logging.debug("!!!!BINGO!!!!")
top_hwnd = hwnd
logging.debug("Find the window at the top")
return False
else:
logging.debug("No matched .....")
return True
评论列表
文章目录