C++制作一个连点器

C++制作一个连点器

​ 今天我下载了一款游戏,还不错,主要是讲的构建地球原始生命的游戏,但是游戏内部的DNA点数需要靠你不断按键取得,有的东西需要十几万DNA点数,但是点一次按键或鼠标只有几十个,仿佛只有单身狗才能做到。所以我就自制了一个连点器,跟大家分享一下。

环境 :

Visual Studio 2019
#include <iostream>
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
using namespace std;

int main()
{ 
    cout << "进入程序\n";
    Sleep(100);
    cout << "开发者:GROZA(QQ:1140457732)\n";
    Sleep(100);
    cout << "请注意:在程序运行中,如果您想要关闭程序,请按下 Q键;本程序连续按下的是 回车键。\n";
    Sleep(2000);
    int a , b;
    while (true)
    {
        if (-32767 == GetAsyncKeyState('Q'))
        {
            system("taskkill -f -im 连点器.exe -t");
        }
        else
        { 
            cout << "请输入您需要连点的次数(输入0退出程序):";
            cin >> a;
            if (a == 0) {
                system("taskkill -f -im 连点器.exe -t");
            }
            else {
                cout << "请问您想让程序按下 鼠标左键 还是 回车键?(输入数字1或2:1:左键;2:回车键;其他键退出):";
                cin >> b;
                if (b == 2) {
                    cout << "正在启动程序,请等待三秒" << endl;
                    Sleep(1000);
                    cout << "3" << endl;
                    Sleep(1000);
                    cout << "2" << endl;
                    Sleep(1000);
                    cout << "1" << endl;
                    for (int i = 1; i <= a; i++) {
                        keybd_event(VK_RETURN, 0, 0, 0);
                        keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
                        Sleep(10);
                        if (-32767 == GetAsyncKeyState('Q'))
                        {
                            system("taskkill -f -im 连点器.exe -t");
                            i = a;
                        }
                    }
                }
                else if (b == 1) {
                    cout << "正在启动程序,请等待三秒" << endl;
                    Sleep(1000);
                    cout << "3" << endl;
                    Sleep(1000);
                    cout << "2" << endl;
                    Sleep(1000);
                    cout << "1" << endl;
                    for (int i = 1; i <= a; i++) {
                        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
                        Sleep(10); 
                        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
                        Sleep(10);
                        if (-32767 == GetAsyncKeyState('Q'))
                        {
                            system("taskkill -f -im 连点器.exe -t");
                            i = a;
                        }
                    }
                }
                else {
                    system("taskkill -f -im 连点器.exe -t");
                }
               
            }
            
        }
    }
}

测试过了能用。希望能对大家有帮助。

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值