First, never compare GetAsyncKeyState() return value with 1, because it does not return a boolean value, but a series of flags. Just check if it is nonzero. And anyway, even if that would have worked, your loop breaks after the first round, because GetAsyncKeyState returns nonzero when the key was not pressed
after the last call. That means, this loop can only execute 1 time.
I think you meant:
Code:
while ( true ) {
if ( !GetAsyncKeyState(VK_UP) ) {
std::cout << ourNum++ << std::endl;
}
}
But you might also want to add something that breaks the loop, perharps another key.