Results 1 to 3 of 3

Thread: KeyBoard Hook - Issue, Hooks while form not being used

  1. #1

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Angry 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?

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    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.

  3. #3

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Re: KeyBoard Hook - Issue, Hooks while form not being used

    Quote Originally Posted by Grimfort View Post
    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
  •  



Click Here to Expand Forum to Full Width