c++实现连点器

本期为大家收集了四个用c++实现连点器的程序(非常好用)

首先是@LiJoQiao提供的第一个版本,能实现连点鼠标左键

#include  
#include    
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)   
#define click mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP,0,0,0,0)
long long N=10000000;
void tj()
{system("cls");printf("输入速度(win10建议10000000,win7建议1500000;v=10000000时,CPS=60左右):");scanf("%lld ",&N); system("cls");
}
void work()
{int now=0,k=0;bool flag=1; while(1){    if(now==1)click;if(KEY_DOWN('1')&&flag)now=1;   if(KEY_DOWN('2')&&flag)now=0;    if(KEY_DOWN('3')){flag=0;now=0;}if(KEY_DOWN('4')){now=0;flag=1;}if(KEY_DOWN('5'))tj();for(long long i=1;i<=N;++i)k=i+1;  }    
}
int main()
{ printf("按1点击左键,按2停止,按3锁定,按4解锁,按5调速\n");  work(); return 0;  
}

然后是@Zimse提供的第二个版本,在第一个版本的使用体验上有所升级

#include 
#include 
#include 
#include 
#include  using namespace std;const char Edition[100]="Zimse Auto Click System23 1.3.04";
int cps=50,up,down; int main(){HWND hwndDOS=GetForegroundWindow();ShowWindow(hwndDOS,SW_HIDE);MoveWindow(hwndDOS,150,150,400,300,true);MessageBox(NULL,"\n\t按左箭头查看帮助",Edition,MB_OK);srand(time(0));while(1){if(GetAsyncKeyState(VK_UP)){while(1){/*if(GetAsyncKeyState(VK_UP)){++up;if(up>20&&cps<900)++cps,up=0;}if(GetAsyncKeyState(VK_DOWN)){++down;if(down>20&&cps>10)--cps,down=0;}*/ mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);if(GetAsyncKeyState(VK_DOWN))break;Sleep(1000/cps);}}if(GetAsyncKeyState(VK_LEFT)){ShowWindow(hwndDOS,SW_RESTORE);system("cls");printf("\n\t基本操作:上箭头开始,下箭头停止\n\n\t右箭头退出,左箭头查看帮助\n\n\t请输入新的cps:"); scanf("%d",&cps);ShowWindow(hwndDOS,SW_HIDE);}if(GetAsyncKeyState(VK_RIGHT))break;}MessageBox(NULL,"\n\t成功退出",Edition,MB_OK);return 0;
}

然后是@Coders提供的支持鼠标右键的版本

#include 
#include 
#include 
#include 
#include 
#include 
using namespace std; 
void set_cursor(bool hide) { // 隐藏/显示 光标HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);CONSOLE_CURSOR_INFO CursorInfo;GetConsoleCursorInfo(handle, &CursorInfo); // 获取控制台光标信息CursorInfo.bVisible = hide;				   // 隐藏控制台光标SetConsoleCursorInfo(handle, &CursorInfo); // 设置控制台光标状态
}
void gotoxy(int x, int y) { // 设置光标COORD c = {(SHORT)x, (SHORT)y};SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
}
void setmode() {HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);DWORD mode;GetConsoleMode(hStdin, &mode);mode &= ~ENABLE_QUICK_EDIT_MODE; // 移除快速编辑模式// mode &= ~ENABLE_INSERT_MODE;	 // 移除插入模式// mode &= ~ENABLE_MOUSE_INPUT;SetConsoleMode(hStdin, mode);
}
struct Click {int x, y;int delay;int button_down, button_up;std::string msg;
};
int main() {setmode();std::printf("欢迎使用鼠标连点器!\n\n");
_ReStart_: // 重新开始的地方system("mode con cols=40 lines=15");set_cursor(true);SetWindowPos(GetConsoleWindow(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); // 窗口置顶std::puts("请选择模式:");std::puts("  1. 点击位置为鼠标指针,鼠标左/右键点击");std::puts("  2. 点击位置固定循环,鼠标左/右键点击");std::puts("  0. 退出");int ch = _getch();while(ch < '0' || ch > '2') ch = _getch();system("cls");set_cursor(false);if(ch == '1') {set_cursor(true);std::puts("配置:");std::printf("请输入每秒钟的点击次数(1—1000):");int spd;std::scanf("%d", &spd);std::printf("\n请选择点击的键(0左键,1右键):");ch = _getch();while(ch < '0' || ch > '1') ch = _getch();int CLICK_BUTTON_DOWN = (ch == '0' ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_RIGHTDOWN);int CLICK_BUTTON_UP = (ch == '0' ? MOUSEEVENTF_LEFTUP : MOUSEEVENTF_RIGHTUP);system("cls");int cont = true, lst_tim = clock();set_cursor(false);while(true) {gotoxy(0, 0);std::printf("连点器%s. . . \n\n", cont ? "运行中" : "已暂停");std::printf("速度:%d次/秒\n", spd);std::printf("  空格键\t%s\n", cont ? "暂停" : "继续");std::printf("  Esc键 \t退出\n");SetWindowPos(GetConsoleWindow(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); // 窗口置顶if(_kbhit()) {int ch = _getch();if(ch == 27) { // Escbreak;} else if(ch == ' ') { // 空格cont = !cont;}} else {if(cont) {if(clock() - lst_tim >= 1.0 / spd * CLOCKS_PER_SEC) {lst_tim = clock();POINT pt;GetCursorPos(&pt);mouse_event(CLICK_BUTTON_DOWN, 0, 0, 0, 0);mouse_event(CLICK_BUTTON_UP, 0, 0, 0, 0);}}}}} else if(ch == '2') {std::printf("请输入您要点击的位置个数:");int times;std::scanf("%d", ×);std::vector ps;set_cursor(true);for(int i = 1; i <= times; i++) {system("cls");std::printf("将鼠标移动到第%d个位置上后按下空格:", i);while(_getch() != ' ') {}POINT p;GetCursorPos(&p);ps.push_back({p.x, p.y, 0, 0, 0, ""});std::printf("\n需要按下的键(0左键,1右键):");char ch = _getch();while(ch < '0' || ch > '1') ch = _getch();ps.back().button_down = (ch == '0' ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_RIGHTDOWN);ps.back().button_up = (ch == '0' ? MOUSEEVENTF_LEFTUP : MOUSEEVENTF_RIGHTUP);std::printf("\n在上一次点击后需要等待多少毫秒:");int delay;std::scanf("%d", &delay);ps.back().delay = delay;std::printf("\n附加描述(可不填):");char msg[10000];gets(msg);gets(msg);ps.back().msg = msg;}int cont = true;int now = 0;int lst_tim = clock();system("cls");set_cursor(false);while(true) {gotoxy(0, 0);std::printf("连点器%s. . . \n\n", cont ? "运行中" : "已暂停");std::printf("当前位置描述:%s\n", ps[now].msg.c_str());std::printf("需要等待:%d秒\n", ps[now].delay);std::printf("点击按键:%s键\n", (ps[now].button_down == MOUSEEVENTF_LEFTDOWN ? "左" : "右"));std::printf("  空格键\t%s\n", cont ? "暂停" : "继续");std::printf("  Esc键 \t退出\n");SetWindowPos(GetConsoleWindow(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); // 窗口置顶if(_kbhit()) {int ch = _getch();if(ch == 27) { // Escbreak;} else if(ch == ' ') { // 空格cont = !cont;}} else {if(cont) {if(clock() - lst_tim > ps[now].delay) {lst_tim = clock();POINT pt;GetCursorPos(&pt);SetCursorPos(ps[now].x, ps[now].y);mouse_event(ps[now].button_down, 0, 0, 0, 0);mouse_event(ps[now].button_up, 0, 0, 0, 0);SetCursorPos(pt.x, pt.y);if(now + 1 == (int)ps.size()) now = 0;elsenow = now + 1;}}}}} elsereturn 0;system("cls");std::printf("欢迎回来!\n\n");goto _ReStart_;return 0;
}

 最后是@incra提供的支持按键的连点器

#include
#include
#include
#include
using namespace std;double times,a=1000;
char key;
int main(){printf("请输入准备按下的按键(字母或数字):");scanf("%c",&key);if(int(key)>='a'&&int(key)<='z')key-=32; printf("请输入需求CPS(建议不超过50):");scanf("%lf",×);printf("按%c开始连点\n",key);double time=a/(times+0.1*times);while(true){if(GetAsyncKeyState(key)){mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);Sleep(time);}}return 0;
}

那今天就到这了,感谢四位大佬,如果有更好的意见欢迎联系小编

完结撒花!!!


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部