Answer the question
In order to leave comments, you need to log in
How to implement mouse click every 5 sec (C++)?
I'm writing something like an autoclicker.
There is an endless loop
while (1)
{
SendMessage(hPointWnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELONG(540,360));
SendMessage(hPointWnd, WM_LBUTTONUP, 0, MAKELONG(540,360));
}
Answer the question
In order to leave comments, you need to log in
If the application is windowed, then it is better to use a timer. Then you can avoid hanging from sleep, and multithreading is not needed.
F12 toggle the flag and, depending on its value, call either SetTimer or KillTimer .
If the application is without a GUI, then @GavriKos solution will do .
Delay - sleep(5000) or something like that.
On f12 - toggle the flag (flag=!flag) in which thread the handler of the pressed key, in the cycle, respectively, the condition - if the flag is set - poke the mouse.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question