I have tried everything I found in google but nothing works. I want to press A
for 5 seconds, but everything presses it only once.It just releases it immediately. Pressing multiple times is not the answer because the key must be pressed for atleast 30ms.
const int KEYEVENT_KEYUP = 0x02;
keybd_event(0x41, 0, 0, 0);
Sleep(5000);
keybd_event(0x41, 0, KEYEVENT_KEYUP, 0);