How do I disable keystroke processing?
This is a discussion on keystroke processing within the Windows Programming forums, part of the Platform Specific Boards category; How do I disable keystroke processing?...
I was reading the article below that said when using GetAsyncKeyState the application can still process input while it doesn't have the input focus. As I understood it, to solve this keystroke processing had to be turned off.
Aha, I have read the part of the article you are speaking about. Basically, it explains two different ways to process keyboard input:
1. the Good Citizen way, using WM_KEYDOWN and WM_KEYUP messages, which are not sent to an application that does not have input focus, so there are no problems when your application loses focus. The bad thing with this is that if your game is slow, someone could press a key and release it (assuming that WM_KEYDOWN and WM_KEYUP are updating a keyboard table that says what keys are down/up), and by the time the table is consulted, it may not 'catch' the fact that a key was down for a brief period of time. This is no good. A second method solves the problem:
2. Use GetAsyncKeyState, which returns whether a key is currently down right now, and if it has been down since the last time you checked, even if it is up now. This way, you never lose the fact that a key was briefly pressed inbetween checks.
Now, the problem is that GetAsyncKeyState is a call that you make (where as WM_KEYDOWN and WM_KEYUP are messages that you get from the system only when you have focus). This means if your program is making this call when it doesn't have focus, then it will still tell you what the current state of the keys are. So, if you ALT-TAB to a word processor, and hold an arrow key down to move the cursor, the character in your game in the background also moves.
The solution? As the article states, and the source of your question: "Be sure to turn off keystroke processing when your game loses the input focus." Basically, this means if your application is not in focus, stop calling GetAsyncKeyState! (i.e. there's nothing to 'disable'.)
(P.S. There is no way I could have arrived at a proper answer to your question without the link you posted in the second post - so, please be as specific as you can in further posts, just as your second post was.)