This article describes the Python implementation method that invokes the window based on the window caption. Share to everyone for your reference. The specific analysis is as follows:
When you know the title of a Windows window, you can call the window with the following code, or even write to the window.
#-*-coding:utf-8-*-
Import Win32gui,win32con
#下面的是窗口的标题名称, this is certain wrong, but in the console can be used normally
#写在文件里要用U编码
a=u " Jb51.net "
Dlg=win32gui. FindWindow (None,a)//controls the handle of the control
with the ID of the control, simulates writing the input box text and presses the Submit key
T1=win32gui. GetDlgItem (dlg,1012)
T2=win32gui. GetDlgItem (dlg,1001)
K1=win32gui. GetDlgItem (dlg,1605)
Win32gui. SendMessage (T1,win32con. Wm_settext,none, ' 902723 ')
Win32gui. SendMessage (T2,win32con. Wm_settext,none, ' 761209 ')
Win32gui. SendMessage (K1,win32con. Bm_click,none,none)
I hope this article will help you with your Python programming.