• win32gui.EnumWindows my.os.EnumWindows.py


    import win32gui
    def _MyCallback(hwnd, extra):
    windows = extra
    temp = []
    temp.append(hex(hwnd))
    temp.append(win32gui.GetClassName(hwnd))
    temp.append(win32gui.GetWindowText(hwnd))
    windows[hwnd] = temp
    windows = {}
    win32gui.EnumWindows(_MyCallback, windows)
    hld=win32gui.FindWindow("TXGuiFoundation",'实时加速工具')

    hldb=win32gui.FindWindow("TXGuiFoundation",'实时加速工具2')



    import win32gui


    def _MyCallback(hwnd, extra):
    windows = extra
    temp = []
    temp.append(hex(hwnd))
    temp.append(win32gui.GetClassName(hwnd))
    temp.append(win32gui.GetWindowText(hwnd))
    windows[hwnd] = temp


    windows = {}
    win32gui.EnumWindows(_MyCallback, windows)
    hld = win32gui.FindWindow("TXGuiFoundation", '实时加速工具')

    hldb = win32gui.FindWindow("TXGuiFoundation", '实时加速工具2')
    """
    手动确定ClassName-WindowText 窗口组名-单独名
    生成临时文件,检索
    with open('tmp.txt', 'w', encoding='utf-8') as fo:
    for i in windows:
    s = '%s%s' % (str(i), str(windows[i]))
    fo.write(s)
    """
    """
    8064026['0x7b0c1a', 'BS2CHINAUI', '']
    201748['0x31414', 'BS2CHINAUI', 'BSCNKEYMAPWND_Android']
    660380['0xa139c', 'BS2CHINAUI', '']
    529522['0x81472', 'BS2CHINAUI', '']
    922564['0xe13c4', 'BS2CHINAUI', 'BlueStacks App Player']

    4390956['0x43002c', 'BS2CHINAUI', 'soui tooltip']
    988220['0xf143c', 'BS2CHINAUI', 'soui tooltip']
    660518['0xa1426', 'BS2CHINAUI', 'soui tooltip']

    """

    windowstext = 'BlueStacks App Player'

    hld_a,hld_b = win32gui.FindWindow('BS2CHINAUI', 'BSCNKEYMAPWND_Android'),win32gui.FindWindow('BS2CHINAUI', 'BlueStacks App Player')




    单元测试 确定安卓模拟器的组名-单个窗口名


    该部完成




  • 相关阅读:
    数据库表与视图的区别
    maven中snapshot版本和正式版本的区别
    @Retention注解
    java泛型以及通配符
    git 删除了本不应该删除的commit 如何恢复
    ES group分组聚合的坑
    solution for 1006 中国剩余定理
    solution for POJ 1001
    ondraw() 和dispatchdraw()的区别
    android几种定时器机制及区别(转载整理)
  • 原文地址:https://www.cnblogs.com/rsapaper/p/8259856.html
Copyright © 2020-2023  润新知