来源于 (2024xuyuntao)#include <bits/stdc++.h> #include <windows.h> using namespace std; int main() { cout << "按空格键开始连点,按ESC键结束..." << endl; while (true) { if (GetAsyncKeyState(VK_SPACE) & 0x8000) { while (true) { mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) { cout << "连点结束。" << endl; return 0; } Sleep(100); } }

if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) { cout << "程序结束。" << endl; return 0; } Sleep(10); }

return 0;

}