python类FindWindow()的实例源码

ExportEBK.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def Menu():
    try:
        #??
        pdhk=win32gui.GetWindowRect(win32gui.FindWindowEx(win32gui.FindWindow('TdxW_MainFrame_Class','???????V7.35 - [???-?????]'),None,'#32770',None))
        win32api.SetCursorPos([pdhk[0]+330,pdhk[1]+10])
        time.sleep(1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0,0,0)
        time.sleep(1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0,0,0)
        time.sleep(1)
        #?????
        win32api.SetCursorPos([pdhk[0]+380,pdhk[1]+20+480])
        time.sleep(1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0,0,0)
        time.sleep(1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0,0,0)
        time.sleep(1)
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))

#???????->?????
AutoRunTDX.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def Free_quotation():
    time.sleep(3)
    try:
        Tab_handle = win32gui.FindWindowEx(win32gui.FindWindow('#32770','???????V7.35'),None,'SysTabControl32','Tab1')
        #print(hex(Tab_handle))
        #time.sleep(1)
        p=win32gui.GetWindowRect(Tab_handle)
        #print(p)
        #print(p[2])
        #print(p[3])
        win32api.SetCursorPos([p[0]+170,p[1]+7])
        time.sleep(1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0,0,0)
        time.sleep(1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0,0,0)
        time.sleep(1)
        win32gui.PostMessage(win32gui.FindWindowEx(win32gui.FindWindow('#32770','???????V7.35'),None,'Button','??'),win32con.BM_CLICK,0,0)
        time.sleep(3)
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))

#?????
AutoRunTDX.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def Stock_option(Index):
    try:
        #tjxg = win32gui.FindWindow('#32770','????')
        gs = win32gui.FindWindowEx(win32gui.FindWindow('#32770','????'),None,'ComboBox',None)
        #time.sleep(1)
        print(hex(gs))
        win32gui.SendMessage(gs,win32con.CB_SHOWDROPDOWN,1,0)  #??ComboBox???
        time.sleep(1)
        win32gui.SendMessage(gs,win32con.CB_SETCURSEL,Index,0)#???????
        time.sleep(1)
        win32gui.SendMessage(gs,win32con.WM_SETFOCUS,0,0)#????
        time.sleep(1)
        win32gui.SendMessage(gs,win32con.WM_KEYDOWN,0,0)#???????
        time.sleep(1)
        win32gui.SendMessage(gs,win32con.WM_KEYUP,0,0) 
        time.sleep(1)
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))
#????
testExplorer.py 文件源码 项目:OSPTF 作者: xSploited 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def TestObjectFromWindow():
    # Check we can use ObjectFromLresult to get the COM object from the
    # HWND - see KB Q249232
    # Locating the HWND is different than the KB says...
    hwnd = win32gui.FindWindow('IEFrame', None)
    for child_class in ['TabWindowClass', 'Shell DocObject View',
                        'Internet Explorer_Server']:
        hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None)
        # ack - not working for markh on vista with IE8 (or maybe it is the
        # lack of the 'accessibility' components mentioned in Q249232)
        # either way - not working!
        return
    # But here is the point - once you have an 'Internet Explorer_Server',
    # you can send a message and use ObjectFromLresult to get it back.
    msg = win32gui.RegisterWindowMessage("WM_HTML_GETOBJECT")
    rc, result = win32gui.SendMessageTimeout(hwnd, msg, 0, 0, win32con.SMTO_ABORTIFHUNG, 1000)
    ob = pythoncom.ObjectFromLresult(result, pythoncom.IID_IDispatch, 0)
    doc = Dispatch(ob)
    # just to prove it works, set the background color of the document.
    for color in "red green blue orange white".split():
        doc.bgColor = color
        time.sleep(0.2)
ExportEBK.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def Save():
    try:
        win32gui.PostMessage(win32gui.FindWindowEx(win32gui.FindWindow('#32770','???'),None,'Button','??(&S)'),win32con.BM_CLICK,0,0)
        time.sleep(1)
        global handle
        handle = None
        win32gui.EnumChildWindows(win32gui.FindWindow('#32770','?????'),handle_window,'?(&Y)')
        if handle!= None:
            win32gui.PostMessage(handle,win32con.BM_CLICK,0,0)
        time.sleep(3)
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))
windows.py 文件源码 项目:ATX 作者: NetEaseGame 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, window_name=None, exe_file=None, exclude_border=True):
        hwnd = 0

        # first check window_name
        if window_name is not None:
            hwnd = win32gui.FindWindow(None, window_name)
            if hwnd == 0:
                def callback(h, extra):
                    if window_name in win32gui.GetWindowText(h):
                        extra.append(h)
                    return True
                extra = []
                win32gui.EnumWindows(callback, extra)
                if extra: hwnd = extra[0]
            if hwnd == 0:
                raise WindowsAppNotFoundError("Windows Application <%s> not found!" % window_name)

        # check exe_file by checking all processes current running.
        elif exe_file is not None:
            pid = find_process_id(exe_file)
            if pid is not None:
                def callback(h, extra):
                    if win32gui.IsWindowVisible(h) and win32gui.IsWindowEnabled(h):
                        _, p = win32process.GetWindowThreadProcessId(h)
                        if p == pid:
                            extra.append(h)
                        return True
                    return True
                extra = []
                win32gui.EnumWindows(callback, extra)
                #TODO: get main window from all windows.
                if extra: hwnd = extra[0]
            if hwnd == 0:
                raise WindowsAppNotFoundError("Windows Application <%s> is not running!" % exe_file)

        # if window_name & exe_file both are None, use the screen.
        if hwnd == 0:
            hwnd = win32gui.GetDesktopWindow()

        self.hwnd = hwnd
        self.exclude_border = exclude_border
testExplorer.py 文件源码 项目:pupy 作者: ru-faraon 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def TestObjectFromWindow():
    # Check we can use ObjectFromLresult to get the COM object from the
    # HWND - see KB Q249232
    # Locating the HWND is different than the KB says...
    hwnd = win32gui.FindWindow('IEFrame', None)
    for child_class in ['TabWindowClass', 'Shell DocObject View',
                        'Internet Explorer_Server']:
        hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None)
        # ack - not working for markh on vista with IE8 (or maybe it is the
        # lack of the 'accessibility' components mentioned in Q249232)
        # either way - not working!
        return
    # But here is the point - once you have an 'Internet Explorer_Server',
    # you can send a message and use ObjectFromLresult to get it back.
    msg = win32gui.RegisterWindowMessage("WM_HTML_GETOBJECT")
    rc, result = win32gui.SendMessageTimeout(hwnd, msg, 0, 0, win32con.SMTO_ABORTIFHUNG, 1000)
    ob = pythoncom.ObjectFromLresult(result, pythoncom.IID_IDispatch, 0)
    doc = Dispatch(ob)
    # just to prove it works, set the background color of the document.
    for color in "red green blue orange white".split():
        doc.bgColor = color
        time.sleep(0.2)
qidong.py 文件源码 项目:chat-robot 作者: wdc63 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def enter():
    time.sleep(2)
    appname = "?????"
    enter = 0x0D
    window = win32gui.FindWindow(None, appname)
    try:
        win32gui.SetForegroundWindow(window)
    except:
        pass
    win32api.keybd_event(enter,0,0,0)
    time.sleep(0.1)
    win32api.keybd_event(enter,0,0,0)
    time.sleep(0.1)
    win32api.keybd_event(enter,0,0,0)
    time.sleep(0.1)
    win32api.keybd_event(enter,0,0,0)
    time.sleep(0.1)
    win32api.keybd_event(enter,0,0,0)
    time.sleep(0.1)
main.py 文件源码 项目:chat-robot 作者: wdc63 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def hawk_enter():
    appname = "?????"
    enter = 0x0D
    count = 0
    while True:
        if count % 10 == 0:
            window = win32gui.FindWindow(None, appname)
            try:
                win32gui.SetForegroundWindow(window)
            except:
                pass
        if window != 0:
            win32api.keybd_event(enter,0,0,0)
            time.sleep(0.05)
            win32api.keybd_event(enter,0 ,win32con.KEYEVENTF_KEYUP ,0)
        time.sleep(1)
        count += 1
testExplorer.py 文件源码 项目:remoteControlPPT 作者: htwenning 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def TestObjectFromWindow():
    # Check we can use ObjectFromLresult to get the COM object from the
    # HWND - see KB Q249232
    # Locating the HWND is different than the KB says...
    hwnd = win32gui.FindWindow('IEFrame', None)
    for child_class in ['TabWindowClass', 'Shell DocObject View',
                        'Internet Explorer_Server']:
        hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None)
        # ack - not working for markh on vista with IE8 (or maybe it is the
        # lack of the 'accessibility' components mentioned in Q249232)
        # either way - not working!
        return
    # But here is the point - once you have an 'Internet Explorer_Server',
    # you can send a message and use ObjectFromLresult to get it back.
    msg = win32gui.RegisterWindowMessage("WM_HTML_GETOBJECT")
    rc, result = win32gui.SendMessageTimeout(hwnd, msg, 0, 0, win32con.SMTO_ABORTIFHUNG, 1000)
    ob = pythoncom.ObjectFromLresult(result, pythoncom.IID_IDispatch, 0)
    doc = Dispatch(ob)
    # just to prove it works, set the background color of the document.
    for color in "red green blue orange white".split():
        doc.bgColor = color
        time.sleep(0.2)
testExplorer.py 文件源码 项目:CodeReader 作者: jasonrbr 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def TestObjectFromWindow():
    # Check we can use ObjectFromLresult to get the COM object from the
    # HWND - see KB Q249232
    # Locating the HWND is different than the KB says...
    hwnd = win32gui.FindWindow('IEFrame', None)
    for child_class in ['TabWindowClass', 'Shell DocObject View',
                        'Internet Explorer_Server']:
        hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None)
        # ack - not working for markh on vista with IE8 (or maybe it is the
        # lack of the 'accessibility' components mentioned in Q249232)
        # either way - not working!
        return
    # But here is the point - once you have an 'Internet Explorer_Server',
    # you can send a message and use ObjectFromLresult to get it back.
    msg = win32gui.RegisterWindowMessage("WM_HTML_GETOBJECT")
    rc, result = win32gui.SendMessageTimeout(hwnd, msg, 0, 0, win32con.SMTO_ABORTIFHUNG, 1000)
    ob = pythoncom.ObjectFromLresult(result, pythoncom.IID_IDispatch, 0)
    doc = Dispatch(ob)
    # just to prove it works, set the background color of the document.
    for color in "red green blue orange white".split():
        doc.bgColor = color
        time.sleep(0.2)
_webkeywords.py 文件源码 项目:robotframework-weblibrary 作者: Netease-AutoTest 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def web_upload_file(self, filepath):
        """????(??flash????)

        filepath ?????????????????????????${CURDIR}${/}Res${/}Plus_Web${/}pic0.jpg
        ${CURDIR}????????????
        RF?filepath???????unicode
        ??????????????????????????????????
        | Web Upload File | ${filepath} |   
        | Web Upload File | ${CURDIR}${/}Res${/}Plus_Web${/}pic0.jpg |  
        """
        filepath=os.path.abspath(filepath)
        change = str(filepath)
        time.sleep(1)
        self._handle = win32gui.FindWindow(None, u"??")#??“??”?????
        win32gui.SetForegroundWindow(self._handle)#??????
        SendKeys.SendKeys(change)
        time.sleep(1)
        SendKeys.SendKeys("{ENTER}")
notification.py 文件源码 项目:garden.notification 作者: kivy-garden 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def _hide_w32_window(self):
        try:
            w32win = win32gui.FindWindow(None, self.title)
            win32gui.ShowWindow(w32win, SW_HIDE)
            win32gui.SetWindowLong(
                w32win,
                GWL_EXSTYLE,
                win32gui.GetWindowLong(
                    w32win, GWL_EXSTYLE) | WS_EX_TOOLWINDOW
            )
            win32gui.ShowWindow(w32win, SW_SHOW)
            self._return_focus_w32()
        except Exception:
            tb = traceback.format_exc()
            Logger.error(
                'Notification: An error occured in {}\n'
                '{}'.format(self.title, tb)
            )
file_upload.py 文件源码 项目:AutoTestFramework 作者: huilansame 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def upload_by_autoit(self, files):
        """autoit?? —— ???????????????????files????list?"""
        self._window_open()
        self._files(files)
        self.logger.info('upload {} by autoit'.format(self.files))

        # ????????
        if win32gui.FindWindow('#32770', self.window_name):
            self.window_open_flag = 1
        else:
            raise UploadWindowNotOpenError('???????????')

        upfile = os.path.abspath(DefaultConfig().base_path + '\\src\\resource\\' + AUTOITEXE[self.driver.name])
        os.system('{0} {1}'.format(upfile, self.files))  # ??exe?????

        self.window_open_flag = 0

    # ??????
win_GUI.py 文件源码 项目:Automation-Framework-for-devices 作者: tok-gogogo 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def GetChildapp(self,str_app):
        print '******** GetChildapp fuction ********'
        hwnd = win32gui.FindWindow(None, str_app)
        if hwnd < 1:
            hwnd = self.find_main_window(str_app)
        if hwnd>1:
            hChild =  win32gui.GetWindow(hwnd,win32con.GW_CHILD)
            bufLen=1024
            buf =win32gui.PyMakeBuffer(bufLen)
            totalnum = 1 
            while hChild :
                hChild = win32gui.GetWindow(hChild,win32con.GW_HWNDNEXT)
                n = win32gui.SendMessage(hChild,win32con.WM_GETTEXT,bufLen,buf)
                str = buf[:n]
                print '@@@@@@@@@@@'
                print win32gui.GetWindowText(hChild)
                print str
                '''
                if totalnum ==3:
                    win32gui.SendMessage(hChild,win32con.WM_SETTEXT,None,'Realtek 10/100/1000 Ethernet NIC')
                '''
                print  totalnum,hChild
                totalnum = totalnum + 1

        print '******** GetChildapp fuction ********',totalnum
win_GUI.py 文件源码 项目:Automation-Framework-for-devices 作者: tok-gogogo 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def Mouse_LB_Double(self,str_app,lb_dx,lb_dy,Flag='1'):
        time.sleep(1)
        tmp=(string.atoi(lb_dx),string.atoi(lb_dy))
        hwnd = win32gui.FindWindow(None, str_app)
        print 'Mouse_RB str_app,hwnd ',str_app,hwnd
        if hwnd < 1:
            hwnd = self.find_main_window(str_app)

        win32api.SetCursorPos(tmp)

        time.sleep(1)
        #win32api.SetDoubleCIckTime()
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1]) 
        time.sleep(0.005)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
        time.sleep(0.005)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1]) 
        time.sleep(0.005)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
        time.sleep(0.005)
        return True
win_GUI.py 文件源码 项目:Automation-Framework-for-devices 作者: tok-gogogo 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def Mouse_RB(self,str_app,lb_dx,lb_dy,Flag='1'):
        print "*********Mouse_RB function**********"
        time.sleep(1)
        tmp=(string.atoi(lb_dx),string.atoi(lb_dy))
        hwnd = win32gui.FindWindow(None, str_app)
        print 'Mouse_RB str_app,hwnd ',str_app,hwnd
        if hwnd < 1:
            hwnd = self.find_main_window(str_app)
            #win32gui.ShowWindow(hwnd, 0)
        win32api.SetCursorPos(tmp)
        print 'Mouse_RB tmp =',tmp
        if Flag == '1':
            time.sleep(1)
            win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,tmp[0], tmp[1]) 
            time.sleep(0.05)
            win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP,tmp[0], tmp[1])
            time.sleep(0.05)
        return True
win_GUI.py 文件源码 项目:Automation-Framework-for-devices 作者: tok-gogogo 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def Mouse_LB(self,str_app,lb_dx,lb_dy,Flag='1'):
        print "*********Mouse_LB function**********"
        time.sleep(1)
        tmp=(string.atoi(lb_dx),string.atoi(lb_dy))
        hwnd = win32gui.FindWindow(None, str_app)
        if hwnd < 1:
            hwnd = self.find_main_window(str_app)
            #win32gui.ShowWindow(hwnd, 0)
            win32api.SetCursorPos(tmp)
            print 'Mouse_LB tmp =',tmp
            if Flag == '1':
                time.sleep(1)
                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1]) 
                time.sleep(0.05)
                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
                time.sleep(0.05)
        return True
ctrl_omnipeek.py 文件源码 项目:Automation-Framework-for-devices 作者: tok-gogogo 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def omnipeek_close(self):

        print 'Close the omnipeek application software'
        hwnd = win32gui.FindWindow('OmniPeek',None) 
        win32gui.SetForegroundWindow(hwnd)
        self.shortcut_keys(['Alt','F'])
        self.sleep('1')
        self.shortcut_keys(['X'])
        self.sleep('1')

        hwd = win32gui.FindWindow(None,'OmniPeek')
        #print hwd
        #The window exist
        if hwd:
            win32gui.SetForegroundWindow(hwd)    #ö
            self.sleep('1')
            self.shortcut_keys(['Alt','Y'])
            self.sleep('5')

        return True
ctrl_pingtest.py 文件源码 项目:Automation-Framework-for-devices 作者: tok-gogogo 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def config_PacketSize(self,time,step,Flag):

        time = string.atoi(time)
        step = string.atoi(step)
        if Flag == 'Up':
            print 'Increasing number of:',time,',increase the step:',step
        elif Flag == 'Down':
            print 'Reduceing number of:',time,',reduce the step:',step
        hwd = win32gui.FindWindow(None,"PingTest")
        edit_packet_up = win32gui.FindWindowEx(hwd, None, 'msctls_updown32', 'Spin1')
        #print edit_packet_up
        self.Mouse_LB_click(edit_packet_up)
        self.shortcut_keys(['Down'])
        self.sleep('1')

        num = time * step
        n = 1
        while n <= num:
            self.shortcut_keys([Flag])
            n = n+1

        return True

    #type:Ping/Stop/Quit/Reset/Clear/Log File:/Error only
ExportEBK.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def CFQS():
    try:
        e = win32gui.GetWindowRect (win32gui.FindWindowEx(win32gui.FindWindowEx(win32gui.FindWindow('#32770','???????'),None,'#32770','???????'),None,'SysListView32','CFQS'))
        win32api.SetCursorPos([e[0]+50,e[1]+25])
        time.sleep(1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0,0,0)
        time.sleep(1)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0,0,0)
        time.sleep(1)
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))

#????
ExportEBK.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def Export_plate():
    try:
        win32gui.PostMessage(win32gui.FindWindowEx(win32gui.FindWindowEx(win32gui.FindWindow('#32770','???????'),None,'#32770','???????'),None,'Button','????'),win32con.BM_CLICK,0,0)
        time.sleep(1)
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))

#???
ExportEBK.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def File_name():
    try:
        win32gui.SendMessage(win32gui.FindWindowEx(win32gui.FindWindow('#32770','???'),None,'Edit',None),win32con.WM_SETTEXT,0,'????'+str(int(time.strftime("%Y%m%d")))+'.EBK')
        time.sleep(1)
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))

#??
AutoRunTDX.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def Open_TDX():
    try:
        handle = win32process.CreateProcess(path+'TdxW.exe','',None,None,0,win32process.CREATE_NO_WINDOW,None,path,win32process.STARTUPINFO())#??TB,?????
        time.sleep(3)
        TDX_handle = win32gui.FindWindow('#32770','???????V7.35')
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))

#????
AutoRunTDX.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def Info():
    try:
        win32gui.PostMessage(win32gui.FindWindow('#32770','?????'),win32con.WM_CLOSE,0,0)
        time.sleep(5)
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))
#???? Ctrl+T
AutoRunTDX.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def Join_condition():
    try:
        #time.sleep(5)
        win32gui.PostMessage(win32gui.FindWindowEx(win32gui.FindWindow('#32770','????'),None,'Button','????'),win32con.BM_CLICK,0,0)
        time.sleep(3)
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))
#????
AutoRunTDX.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def Complement_data():
    try:
        time.sleep(3)
        if win32gui.FindWindowEx(win32gui.FindWindow('#32770','TdxW'),None,'Button','?(&Y)') != 0:
            win32gui.PostMessage(win32gui.FindWindowEx(win32gui.FindWindow('#32770','TdxW'),None,'Button','?(&Y)'),win32con.BM_CLICK,0,0)
            time.sleep(5)
            print("???")
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))
#?????
AutoRunTDX.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def Close_Stockpickingmachine():
    time.sleep(5)
    try:
        #while win32gui.FindWindowEx(win32gui.FindWindow('#32770','????'),None,'Static','????. ') == 0:
            print("????")
            time.sleep(1)
            #if win32gui.FindWindowEx(win32gui.FindWindow('#32770','????'),None,'Static','????. ') != 0:
            win32gui.PostMessage(win32gui.FindWindow('#32770','????'),win32con.WM_CLOSE,0,0)
            time.sleep(3)
            print("????")
                #break
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))
AutoRunTDX.py 文件源码 项目:tdx 作者: sqltxt 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def Close_TDX():
    try:
        time.sleep(3)
        lstj=win32gui.FindWindow('TdxW_MainFrame_Class','???????V7.35 - [???-?????]')
        print(hex(lstj))
        win32gui.PostMessage(lstj,win32con.WM_CLOSE,0,0)
        time.sleep(3)
        win32gui.PostMessage(win32gui.FindWindowEx(win32gui.FindWindow('#32770','????'),None,'Button','??'),win32con.BM_CLICK,0,0)
        time.sleep(3)
    except Exception as e:
        ReadEBK.wx_msg(corp_id, secret,agentid,sys._getframe().f_code.co_name+'\t'+str(e))
grabscreen.py 文件源码 项目:OpenAI_Challenges 作者: AlwaysLearningDeeper 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def grab_screen(region=None, title=None):
    hwin = win32gui.GetDesktopWindow()
    if region:
        left,top,x2,y2 = region
        width = x2 - left + 1
        height = y2 - top + 1
    elif title:
        gtawin = win32gui.FindWindow(None, title)
        if not gtawin:
            raise Exception('window title not found')
        #get the bounding box of the window
        left, top, x2, y2 = win32gui.GetWindowRect(gtawin)
        width = x2 - left +1
        height = y2 - top +1
    else:
        width = win32api.GetSystemMetrics(win32con.SM_CXVIRTUALSCREEN)
        height = win32api.GetSystemMetrics(win32con.SM_CYVIRTUALSCREEN)
        left = win32api.GetSystemMetrics(win32con.SM_XVIRTUALSCREEN)
        top = win32api.GetSystemMetrics(win32con.SM_YVIRTUALSCREEN)

    hwindc = win32gui.GetWindowDC(hwin)
    srcdc = win32ui.CreateDCFromHandle(hwindc)
    memdc = srcdc.CreateCompatibleDC()
    bmp = win32ui.CreateBitmap()
    bmp.CreateCompatibleBitmap(srcdc, width, height)
    memdc.SelectObject(bmp)
    memdc.BitBlt((0, 0), (width, height), srcdc, (left, top), win32con.SRCCOPY)

    signedIntsArray = bmp.GetBitmapBits(True)
    img = np.fromstring(signedIntsArray, dtype='uint8')
    img.shape = (height,width,4)

    srcdc.DeleteDC()
    memdc.DeleteDC()
    win32gui.ReleaseDC(hwin, hwindc)
    win32gui.DeleteObject(bmp.GetHandle())

    return cv2.cvtColor(img, cv2.COLOR_BGRA2RGB)


问题


面经


文章

微信
公众号

扫码关注公众号