How do i enable/disable a loop with getasynckeystate()
I need a code example of being able to put something in a loop and then being able to disable and enable it by pressing a key.
I know how to enable and disable stuff
Code:
if (GetAsyncKeyState(VK_F11))
{
if(!keyWasPressed)
{
keyWasPressed = true;
cout << "\n Enabled" << endl;
Skip();
Sleep(400);
}
else
{
keyWasPressed = false;
cout << "\n Disabled" << endl;
Sleep(400);
}
}
But how do i make it so that when they press F11 it constantly does this code
Code:
cout << "\n Enabled" << endl;
Skip();
but as soon as they hit F11 again is disables the loop
Re: How do i enable/disable a loop with getasynckeystate()
You'd be better explain what you are trying to achieve!
Then you could, perhaps get some suggestions about how to do/implement it.
BTW, where is the code you posted supposed to work? In what application/process/thread?