PDA

View Full Version : exclusive input (win32)



dans
07-06-2000, 03:19 PM
I have my app scan for keycodes, now this works fine only problem being when the key is hit inside my app i want only my app to accept those key presses. It also works the other way around. If i am running in a window (even if the window is not active) and i hit one of my keys in a text editor my app also picks up the key press and reacts to it. Any ideas on how i can keep my key presses exclusive to my app? This is all based in win32 using getAsyncKeyState.
Thanks in advance for any help.

DFrey
07-06-2000, 04:21 PM
Umm, you can only do about half of what you want to do. You can have your app check to see if it has the focus, and if it doesn't to ignore key input. But you can't prevent another app from seeing the keypress since the keyboard can not be used exclusively by just one app. Well, at least not easily. You might be able to use a system hook to prevent other apps from receiving input but that is a bad idea in general.