AutoIt-Sends simulated keystrokes to the inactive window.

Source: Internet
Author: User

To create a "shortcut key" for an inactive window, you must use the HotKeySet function to associate it. Instead, you cannot use GUISetAccelerators to associate the shortcut to the form or space.

1 $ Form1 = GUICreate ("AcceleratorDemo", 160, 60,-1,-1)
2 Opt ("GUICoordMode", 2)
3 $ Btn1 = GUICtrlCreateButton ("Button1", 30, 10)
4 $ Btn2 = GUICtrlCreateButton ("Button2", 0,-1)
5; Dim $ AccelKeys [2] [2] = [["{F9}", $ Btn1], ["a", $ Btn2];
6; GUISetAccelerators ($ AccelKeys)
7 GUISetState (@ SW_SHOW)

Because GUISetAccelerator can only quickly associate an activated form. If the form loses focus, the corresponding "Acceleration key" does not work. Use HotKeySet to directly bind the function to be called.

 

To understand the relationship between the "Accelerator key" and "hotkey", both are used to handle Keyboard Events and then processed by corresponding processing functions. However, they have different application scopes. The "Acceleration key" is associated with the application context, so it only works for the focused form. The "hotkey" is useful in the system.

 

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.