c++连点器

#include<iostream>
#include<windows.h>
#include<conio.h>
#include<string>
using namespace std;
int wait1 = 10, wait2 = 90;
float speed = 10;
string B = "左键", mode = "按住";
void menu() {
	cout << "看操作说明请按[F1],常见问题请按[F2]" << endl << endl;
	cout << "当前控制模式:" << mode << endl << "当前控制按键:" << B << endl << "当前连点速度:" << speed << "次/s" << endl;
}
void FAQ() {
	system("cls");
	cout << "为什么显示的点击速度和输入的点击速度不一样?" << endl;
	cout << "——该程序控制点击速度的时间单位为ms,因此请以显示速度为参考" << endl << endl;
	cout << "为什么实际点击速度和显示的点击速度不一样?" << endl;
	cout << "——受限于电脑硬件的处理速度影响,程序显示速度与实际速度有偏差为正常现象" << endl << endl;
	cout << "为什么使用起来会卡顿" << endl;
	cout << "——连点速度过快会大量消耗CPU资源,如有此现象建议降低点击速度" << endl << endl;
	Sleep(1000);
	system("PAUSE");
	menu();
}
void help() {
	system("cls");
	cout << "[鼠标中键]:开始/暂停 连点" << endl << "[方向键←]:控制鼠标左键" << endl << "[方向键→]:控制鼠标右键" << endl;
	cout << "[右Ctrl]:切换控制模式" << endl << "[右Shift]:设置每秒连点次数" << endl << "[右Alt]:暂停程序" << endl << "[End]:中止程序" << endl << endl;
	Sleep(1000);
	system("PAUSE");
	menu();
}
bool set() {
	cin.clear();
	cin.sync();
	system("cls");
	cout << "请输入每秒点击次数:";
	cin >> speed;
	system("cls");
	if (speed < 0) speed = speed * -1;
	if (speed < 0.0001) {
		cout << "输入错误!";
		Sleep(1500);
		return 1;
	}
	if (speed > 1000) {
		cout << "警告!大于1000次/秒的连点速度不可控,可能会导致电脑卡顿!" << endl;
		cout << "是否继续当前设定?" << endl << "1:是,保留设定 2:否,重新设定";
		getch();
		if (GetKeyState(49) < 0 || GetKeyState(97) < 0) speed = 9999;
		else return 1;
	}
	wait1 = 500 / speed;
	if (wait1 > 10) wait1 = 10;
	wait2 = 1000 / speed - wait1;
	if (speed != 9999) speed = (float)1000 / (wait1 + wait2);
	menu();
	return 0;
}
void click() {
	if (B == "左键") {
		mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
		Sleep(wait1);
		mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
		Sleep(wait2);
	} else {
		mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
		Sleep(wait1);
		mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
		Sleep(wait2);
	}
}
int main() {
	for (int i = 0; i <= 300; i++) {
		if (i == 0)system("color 4F");
		if (i == 50)system("color 2F");
		if (i == 100)system("color 1F");
		if (i == 150)system("color 4F");
		if (i == 200)system("color 6F");
		if (i == 250)system("color 1F");
		if (i % 4 == 0)cout << endl;
		if (i <= 50)cout << "| 欢迎 |";
		if (i <= 100 && i > 50)cout << "| 使用 |";
		if (i <= 150 && i > 100)cout << "| 由 |";
		if (i <= 200 && i > 150)cout << "| 矿枝 |";
		if (i <= 250 && i > 200)cout << "| 开发的 |";
		if (i > 250)cout << "| 鼠标连点器 |";
		Sleep(1);
	}
	system("color 0F");
	menu();
	while (GetKeyState(35) == 0) {
		if (GetKeyState(4) && mode == "切换") {
			click();
			continue;
		}
		if (GetKeyState(4) < 0 && mode == "按住") {
			click();
			continue;
		}
		if (GetKeyState(37) < 0 && B != "左键") {
			B = "左键";
			menu();
		}
		if (GetKeyState(39) < 0 && B != "右键") {
			B = "右键";
			menu();
		}
		if (GetKeyState(112) < 0) help();
		if (GetKeyState(113) < 0) FAQ();
		if (GetKeyState(VK_RSHIFT) < 0) while (set());
		if (GetKeyState(VK_RCONTROL) < 0) {
			if (mode == "按住") mode = "切换";
			else mode = "按住";
			while (GetKeyState(VK_RCONTROL) < 0) Sleep(10);
			menu();
		}
		if (GetKeyState(VK_RMENU)) {
			system("cls");
			cout << "程序已暂停,按[右ALT]继续...";
			while (GetKeyState(VK_RMENU)) Sleep(10);
			menu();
		}
		Sleep(1);
	}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值