-
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.
-
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
-
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.