When you enter the number of seconds begins to load the processor.
#include <iostream> #include <Windows.h> using namespace std; int main() { int time,x,y; bool state = false; cout << "Time between clicks(in ms): "; cin >> time; cout << "Press F12 to activate / deactivate the script."; POINT mouse; while(true) { if (GetAsyncKeyState(VK_F12)) { if (state == false) { state = true; Sleep(250); } else { state = false; Sleep(250); } } if (GetKeyState(VK_LBUTTON) & 0x8000 && (state == true)) { GetCursorPos(&mouse); mouse_event(MOUSEEVENTF_LEFTUP,mouse.x,mouse.y ,0,0); mouse_event(MOUSEEVENTF_LEFTDOWN,mouse.x,mouse.y ,0,0); Sleep(time); } if (GetKeyState(VK_RBUTTON) & 0x8000 && (state == true)) { GetCursorPos(&mouse); mouse_event(MOUSEEVENTF_RIGHTUP,mouse.x,mouse.y ,0,0); mouse_event(MOUSEEVENTF_RIGHTDOWN,mouse.x,mouse.y ,0,0); Sleep(time); } } } What can be done in this situation?
Sleep(1)after while - you will immediately see the result. - nick_n_a