Keybd is not working right =(
Posted
by user302131
on Stack Overflow
See other posts from Stack Overflow
or by user302131
Published on 2010-04-02T02:07:50Z
Indexed on
2010/04/02
2:13 UTC
Read the original article
Hit count: 403
i can't get this to work right this should press left for 1sec then wait 10secs then right 1sec.
keybd_event(0x25, 0xCB, 0, 0); // press left
cout << "Ldown\n"; // so i know it worked
Sleep(1000); // hold it for 1sec
keybd_event(0x25, 0xCB, KEYEVENTF_KEYUP, 0);// let go of the key
cout << "Lup\n"; // so i know i let go
Sleep(10000); // Sleep for 10secs
keybd_event(0x27, 0xCD, 0, 0); // press right
cout << "Rdown\n"; // so i know i pressed right
Sleep(1000); // sleep 1sec
keybd_event(0x27, 0xCD, KEYEVENTF_KEYUP, 0);// let go of the key
cout << "Rdown\n"; // so i know i let go.
this is in a loop but it wont do anything :( unless i close the program before the key is let go then it will just keep the keydown until i press the key again.
i know you can use only one key code if you want but i need to use both.
so what i'm i missing?
© Stack Overflow or respective owner