I believe the best way would be to use asynchronous key checking using the function:
GetAsyncKeyState
macro:
Code:
#define KEY_DOWN(vk_code) ((GetAsyncKeyState((vk_code))&0x8000 ? 1:0))
Probably not the best way to do it, as you'll need to have a loop sitting in the background checking the state every few milliseconds. I'd suggest putting Sleep function in there so the program doesn't hog the cpu.
so you might do something like this:
Code:
while(isGoing)
{
Sleep(100);
if(KEY_DOWN(VK_ESCAPE))
{
// do stuff!
}
}
or something like that
-hope that helps