Results 1 to 3 of 3

Thread: OS-Wide Keyboard event?

  1. #1

    Thread Starter
    New Member Araknofobik's Avatar
    Join Date
    Mar 2002
    Posts
    4

    OS-Wide Keyboard event?

    Hey there.

    You know how there is an event like Form_KeyPress (or any abject for that matter)? Well I was wondering if there was some sort of API call or other thing where when a key is pressed an event is triggered even if the form doesn't have focus. (I know that there are keyboard check API functions but in order to detect a key press a timer would be needed) Or maybe there is an ActiveX control? If so it would be great if you could provide a download link to that.

    Well I guess that's all. Please reply. Thanks.
    ~Araknofobik~

  2. #2
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    If you are looking for a system wide response to a specific key, you can use the MCL Hotkey OCX (with code also on the same site) which triggeres a Hotkey_Pressed() event when the key combination specified in it's settings is pressed.

    On the other hand, if you want to trap every keypress system wide (for a key logger type thing) you need to install a WH_KEYBOARD_LL hook. This is only available in NT, Win2000 or WinXP though.

    HTH,
    Duncan
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

  3. #3
    Addicted Member Virtual24's Avatar
    Join Date
    May 2001
    Posts
    228
    no, you would not need a timer to check for key events... Just use a While Loop... but make sure to put DoEvents int your while loop somwhere so windows will continue to function and not freeze up.... timers suck... very unaccurate.
    To protect time is to protect everything...

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