how can I check if Ctrl is KeyDown, do some function, but not only in my form, but whole OS? I see a many of examples, but there is only for all keys, I need only for Ctrl.
2 replies to this topic
#1
Posted 24 August 2011 - 06:57 AM
|
|
|
#2
Posted 24 August 2011 - 10:44 AM
In that case, you're going to have to use some system hooks. There should be some Windows API functions for this. Torry's Delphi Pages
#3
Posted 20 November 2011 - 10:51 PM
If you okay with polling approach, then you can use windows api GetKeyboardState or GetKeyState in a timer to see if Ctrl is down. For interrupt approach, you need to install system-wide hook to intercept keyboard messages. This hook notifies your program when it detects WM_KEYDOWN with Ctrl key specified.
Visit my tutorial (http://forum.codecal...elphi-code.html) to start learning about keyboard hook. However in your case, function KBHookHandler should not drop all messages, but to look for WM_KEYDOWN with Ctrl key specified messages and notifies (either by postmessage or sendmessage or through named piped) your program.
Visit my tutorial (http://forum.codecal...elphi-code.html) to start learning about keyboard hook. However in your case, function KBHookHandler should not drop all messages, but to look for WM_KEYDOWN with Ctrl key specified messages and notifies (either by postmessage or sendmessage or through named piped) your program.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









