Sign in to follow this  
Followers 0
OiMunk

HotKeySet() not swallowing keystroke..

4 posts in this topic

Despite using HotkeySet(), the window is still receiving the set key. Strangely, the key is not passed for every other application except the one I'm using it for (EarMaster Pro). Are some applications written in a way that nullifies the key swallow?

HotKeySet("{SPACE}","test")

HotKeySet("{ESC}","exitt")

while 1 ; main LOOP

sleep(11)

WEnd

Func test()

;do something

sleep(11)

EndFunc

Func exitt()

HotKeySet("{ESC}")

HotKeySet("{SPACE}")

Exit

EndFunc

Share this post


Link to post
Share on other sites



You need something like this if you have a window or whatever that can help you to determine whether to handle the hot-key or to pass it:

If WinGetHandle("[ACTIVE]") = $hGUI Then
    Exit
Else
    HotKeySet("{ESC}")
    Send("{ESC}")
    HotKeySet("{ESC}", "exitt")
EndIf

Share this post


Link to post
Share on other sites

The problem is that the key is passed regardless of whether I've set the hotkey or not. I actually need to use the hotkey in the stubborn application, so I don't see how that switch would help.

In case my example wasn't clear:

the "{SPACE}" key is sent to the window, even though i've used hotkeyset("{SPACE}","test"). A bug?

cheers

Share this post


Link to post
Share on other sites

It seems like you can't do that using HotKeySet because if you use SetWindowsHookEx you can still be notified about WM_KEY* events. Try to test using the example of _WinAPI_SetWindowsHookEx and see if you can block the key from being sent to the rest of the chain. Try once when your script load first and once when after.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0