you can use escape- it just eats more memory to do it
theres an API called GetAsyncKeyStat e(byte VirtualKey) <-check out msdn on it

anyways, put a call to that in seperate thread that you'll start before the while loop. the thread will look something like
thread name( and params)
{
while(1)
if(GetAsyncKeyS tate(VK_ESCAPE) ) exit(0);
}


threads are easy to learn...