Re: GetAsyncKeyState Help
well when you do this
Code:
if (GetAsyncKeyState(VK_SHIFT))
{
cout << "hi";
you could try adding a pause funtion in there
Code:
if (GetAsyncKeyState(VK_SHIFT))
{
cout << "hi";
system("pause");
}
but im guessing you don't want to do that you want one press, one message so try something like
Code:
if (GetAsyncKeyState(VK_SHIFT))
{
cout << "hi";
_sleep(70);
}
this would make it to where you would have time to let go of the button for it to display only one because it would wait before continuing.
this didn't work in one of my programs for unknown reasons since i didn't get any errors when compiling and when i tried your code it didn't work either. so this is just what i think should work. :P
if it doesn't im sorry because i am also a beginner but still want to help.
Re: GetAsyncKeyState Help
You say you're making a console application, yet GetAsyncKeystate is a "windows" function - while it can be called, and it can work, it does what it says - gets the state of the keyboard asynchronously - that is, without respect to the number of times a key is pressed.
Look at the sample for kbhit (deprecated _kbhit), check the compatibility notes, and consider it in concert with getch. There are several alternatives.