def Find_Gui_edit(self,str_app='´ò¿ª',control_class='ComboBox',filename='wtp_cuo1.pcap',control_name='',stop_flag='0'):
print "*********Find_Gui_edit function**********",str_app
time.sleep(1)
#self.Mousepos_print()
print 'str_app',str_app
hwnd = win32gui.FindWindow(None, str_app)
print 'hwnd',hwnd
win32gui.SetForegroundWindow(hwnd)
comboHwnd = win32gui.FindWindowEx(hwnd,0,control_class,None)
bufLen=256
buf =win32gui.PyMakeBuffer(bufLen)
while comboHwnd:
if stop_flag=='1':
win32gui.SendMessage(comboHwnd,win32con.WM_SETTEXT,bufLen,filename)
time.sleep(1)
break
print "control_class:",comboHwnd
cla = win32gui.GetClassName(comboHwnd)
print cla
if control_class in cla:
n = win32gui.SendMessage(comboHwnd,win32con.WM_GETTEXT,bufLen,buf)
str = buf[:n]
if (len(control_name ) ==0 and n==0) or (len(control_name )>0 and str.find(control_name)>-1 ):
win32gui.SendMessage(comboHwnd,win32con.WM_SETTEXT,bufLen,filename)
time.sleep(1)
break
comboHwnd = win32gui.GetWindow(comboHwnd,win32con.GW_HWNDNEXT)
time.sleep(1)
return True
win_GUI.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录