|
-
Sep 7th, 2011, 08:35 AM
#1
Thread Starter
Addicted Member
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?
-
Sep 7th, 2011, 08:48 AM
#2
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.
-
Sep 7th, 2011, 09:18 AM
#3
Thread Starter
Addicted Member
Re: KeyBoard Hook - Issue, Hooks while form not being used
 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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|