Reputation: 811
Im using:
keybd_event(0x41, 0, 0, 0);
0x41 is a 'a'. But that just prints one 'a' to the screen. I need it to hold down the key. And when i call
keybd_event(0x41, 0, KEYEVENTF_KEYUP, 0);
it must release the key.
Is that possible?
Upvotes: 0
Views: 4441
Reputation: 35188
You could replace the keybd_event
call with SendInput. You can insert as many keystroke events as the event system will allow. The function returns the number of events successfully inserted.
Upvotes: 1
Reputation: 22719
What are you trying to accomplish? The keys that are intended to remain pressed should already do so with your first line.
Here's the documentation for keybd_event(). Maybe it will help answer your question. (And maybe you needed the GetKeyboardState() method?)
If you're simply trying to repeatedly strike a key, it would be easier to loop around the first call than to try to get the system to auto-repeat. You can find the proper delay to use in the system information API functions.
Upvotes: 0