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')




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


该部完成




posted @ 2018-01-10 17:34  papering  阅读(1092)  评论(0编辑  收藏  举报