Python implements methods for invoking Windows based on window caption

Source: Internet
Author: User
This article describes a Python implementation method that invokes a window based on a 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 use the following code to call the window, or even write to the window inside the content.

#-*-coding:utf-8-*-import win32gui,win32con# The following is the title name of the window, so it must be wrong, but in the console can be used normally # written in a file to use the U code a=u "Bitscn.com" dlg= Win32gui. FindWindow (NONE,A)//Use the control's ID to get a handle to the control, simulate writing the input box text and press the Submit button 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)

Hopefully this article will help you with Python programming.

  • 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: info-contact@alibabacloud.com 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.