Python implements the method of calling the window according to the window caption _python

Source: Internet
Author: User

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.

Import Win32gui,win32con
#下面的是窗口的标题名称, this is certain wrong, but in the console can be used normally
a=u " "
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.