WindowFinder.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:myautotest 作者: auuppp 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号