KeyBoard Hook - Issue, Hooks while form not being used
I Have a keyboard hook in my application in some of the forms.
This hook is mainly being used to catch 2 keys:
Escape = Will prompt to close the form
F5 = Will pop up a inputbox for the user to send a direct command to the DB.
These hooks call functions already being used by buttons, but the hooks are there for comfort.
The problem comes in when the form is not active and one of these keys is used.
If the user hits the escape button on the keyboard while using another application like MS Word for example, then my application picks up that escape and runs the commands set for it.
Is there a way to restrict these hooks to only fire when the user is actually using the screen?
Re: KeyBoard Hook - Issue, Hooks while form not being used
The only reason to use a global hook is to be able to monitor a key press even when your form does not have focus. It sounds like you never needed to do that. A form can monitor key events, see here.
Re: KeyBoard Hook - Issue, Hooks while form not being used
Quote:
Originally Posted by
Grimfort
The only reason to use a global hook is to be able to monitor a key press even when your form does not have focus. It sounds like you never needed to do that. A form can monitor key events, see
here.
Ahhh man, you are my HERO!!!
Thanks a lot!