-
Auto KeyPress?
I am relatively new to C programming (I have been programming for about a month now) and was wondering if there was a function out there that would automatically press a selected button over and over again. Example: If I wanted the space button hit a bunch of times I could run this program instead of sitting here at the keyboard for a long time. Is this possible?
~Sven
-
-
State your OS and compiler.
-
Windows XP Home and Dev-C++ (4.9.9.2)
-
Yes, it's still possible. Start searching http://www.msdn.com
They'll have info on basically anything you need to program on a Windows operation system.
-
... via the SendInput API ...
-
Thanks but can someone please post an example of how to use that. I don't really understand how that would work. I could use it to create a function that is simpler. Thanks for all of the help!
~Sven
-
A moderator should probably move this to Windows programming?
It's beyond the scope of C alone.
-
-
Never used it before but the msdn docs aren't that hard to decipher:
Code:
INPUT Input;
ZeroMemory(&Input, sizeof(INPUT));
Input.type = INPUT_KEYBOARD;
Input.ki.wVk = VK_ESCAPE;
SendInput(1, &Input, sizeof(INPUT));
-
I used SendMessage(handle, WM_IME_KEYDOWN, VK_RETURN, 0); to send enter to a hwnd
-
>>automatically press a selected button over and over again
The button is not in your app then. so you will have to find the buttons HWND (handle). It also has to be the 'default' button to accept SPACE or ENTER as input.
BTW most advertising reward programs now discount multiple clicks from the same IP or clicks too close together / regular.
-
>> I used SendMessage(handle, WM_IME_KEYDOWN, VK_RETURN, 0); to send enter
>> to a hwnd
That only send the message to a defined program, not to the whole system like SendInput.
-