Pause program til press key

Posts 1–10 of 10 · Page 1 of 1
Pause program til press key
Hey guys i know its a little noob but i want to when a key is pressed program pause and when pressed other continue can u guys help?
Like if(GetAsyncKeyStateK(VK_LMENU)) It pauses now and when
if(GetAsyncKeyState(VK_SHIFT)) It continues =).
What program are you making ?
You can do something like this:

[highlight=c++]
if(GetAsyncKeyState(VK_SPACE))
{
//Simulate a key press; although it is not needed if you use _getch();
keybd_event(VK_SPACE, 0, 0, 0);
//Wait for half a second.
Sleep(500);
keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP, 0);
}
[/highlight]

Though I don't understand the purpose of that. You can just use _getch(); which waits for the user to press any key to continue the execution of program. Also, pressing shift doesn't do shit, so you got to use some other key. I used space.
@Hassan I tried to used getch but dont worked how i think
@Khalifa Its a tapper.
Post the current code you have..
I cant now =$
Logged on phone Im at school ~.~
Quote Originally Posted by KissU View Post
Hey guys i know its a little noob but i want to when a key is pressed program pause and when pressed other continue can u guys help?
Like if(GetAsyncKeyStateK(VK_LMENU)) It pauses now and when
if(GetAsyncKeyState(VK_SHIFT)) It continues =).
...bool testZero = true;...

while(testZero)
{

sleep(50);
if(testOne = false && GetAsyncKeyStateK(VK_LMENU))
{
bool testOne = true;
}
if(GetAsyncKeyState(VK_NUMPAD1) &1)
{
bool testTwo = true;
testZero = false;
}

}

Will this work?
You talking to me?
Nevermind im over it I just google it more
/Request close Thanks guys
Alright. Closed on request.
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?