Check for key presses, always

Mar 6, 2013 at 7:20am
How can I check for key presses while also doing other tasks?
I currently have:
1
2
3
while(1)
	if (GetAsyncKeyState(VK_A))
		dostuff();

This might not be possible, so please tell my if it isn't.
Thanks.
Last edited on Mar 6, 2013 at 7:20am
Mar 6, 2013 at 11:02am
I am facing same Problem...... :(
Mar 6, 2013 at 11:10am
Normally you'd use an API that records keypresses as keypress events in a queue which you can later clear. If you want to react to these events while you're literally doing something else, you'll have to use threads.
Mar 6, 2013 at 6:19pm
Thanks, I will look into threads.
Mar 6, 2013 at 6:38pm
Actually, before doing that you'll really want to look into events. I'm not sure what exactly you're trying to do, but you probably don't need threads for it.
Topic archived. No new replies allowed.