Answer the question
In order to leave comments, you need to log in
Delphi - software emulation of holding keyboard buttons
I'm trying to solve the problem - to emulate holding the keys q, w, e, r, t, y with a given time limit.
Similar to how we hold down the key for example in this text field
for
2 seconds
: I tried to do it like this:
But in this case, the number of characters will be different from if I held down the key myself (200 characters will be entered) + I think this approach is wrong.
Tell me in which direction to dig in order to achieve a realistic input of a pressed key :)
C := ord('Q');
keybd_event(C,0,0,0);
sleep(2000);
keybd_event(C,0,KEYEVENTF_KEYUP,0);
C := ord('Q');
for i := 1 to 200 do begin
keybd_event(C,0,0,0);
sleep(10);
end;
keybd_event(C,0,KEYEVENTF_KEYUP,0);
Answer the question
In order to leave comments, you need to log in
Auto-repeat of buttons, unfortunately, will have to be implemented by yourself.
Use the registry key KEY_CURRENT_USER\Control Panel\Keyboard\KeyboardSpeed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question