#include <windows.h>
#include <iostream>
using namespace std;
// 模拟鼠标左键单击
void ClickLeftMouse()
{
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
int main()
{
cout << "==== 自动连点器 ====" << endl;
cout << "Y 键:开始连点" << endl;
cout << "L 键:暂停连点" << endl;
cout << "ESC 键:关闭程序\n" << endl;
bool isRunning = false; // 标记是否正在点击
while (true)
{
// ESC 退出程序
if (GetAsyncKeyState(VK_ESCAPE) & 0x8000)
{
cout << "\n已退出程序" << endl;
break;
}
// Y 开始
if (GetAsyncKeyState('Y') & 0x8000)
{
isRunning = true;
cout << "已开启自动点击" << endl;
Sleep(200); // 防按键重复触发
}
// L 暂停
if (GetAsyncKeyState('L') & 0x8000)
{
isRunning = false;
cout << "已暂停自动点击" << endl;
Sleep(200);
}
// 运行状态才点击
if (isRunning)
{
ClickLeftMouse();
}
Sleep(100); // 间隔0.1秒
}
system("pause");
return 0;
}
苏烨城在2026-08-03 11:07:40追加了内容
每0.1秒会点一下,y开始,l暂停,esc退出
