Keybd is not working right =(
- by user302131
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?