# -*- coding: UTF-8 -*-import win32gui, win32conimport osimport timeimport win32guiimport win32apiimport win32conimport pythoncomimport glob# import autoitfrom PIL import ImageGrabglobal windowSVClient=u"SVClient"hwndChildList = []def mouse(opt): global window opt=opt.decode(encoding='UTF-8',errors='strict') option = win32gui.FindWindowEx(window, None, None, opt) # 获取选项的句柄 left, top, right, bottom = win32gui.GetWindowRect(option) win32api.SetCursorPos((left+10,top+5)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0) time.sleep(0.05) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)def show(winname): global window window = win32gui.FindWindow(0, winname) if winname=='resource access': win32gui.EnumChildWindows(window, lambda hwnd, param: param.append(hwnd), hwndChildList) #遍历子句柄 win32gui.ShowWindow(window, win32con.SW_SHOW) #显示 # win32gui.SetForegroundWindow(hwd) #获取焦点 win32gui.ShowWindow(window, win32con.SW_NORMAL) #显示最前def sendmessage(hwnd,text): win32api.SendMessage(hwnd, win32con.WM_SETTEXT, 0, text.encode('gbk')) #向控件发送数据show(SVClient)mouse('显示资源')show('resource access')sendmessage(hwndChildList[1],u'NA_1_170')