zoukankan      html  css  js  c++  java
  • Re:连点器

    连点器

    介绍

    顾名思义,可以连续点的机器。

    当然,连续可快可慢;机器意味着不许要人工点击;可以是生活中的机器,也可以是电脑中的程序。

    现在,连点器网上一搜一大堆,什么鼠标连点精灵鼠大侠……不仅有电脑的,还有安卓系统的。

    但是,用这些软件,我很不放心。说不定就有什么木马病毒呢……

    再说,我们这些coder都不喜欢那些总是误报的杀软,测试程序时等了十几秒结果弹出个“危险木马程序”的警告,所以(我)在code时一般是不开360等杀软的。

    那怎么办呢?

    既然我们是coder,那么这种程序应该用我们的双手亲手写下吧!(当然你要Ctrl+C&Ctrl+V我也没办法……)

    Code0

      1 #include<stdio.h>
      2 #include<stdlib.h>
      3 #include<iostream>
      4 #include<windows.h>
      5 using namespace std;
      6 #define IL inline
      7 #define RE register
      8 
      9 POINT curpos;//鼠标的位置
     10 float i;//点击速度
     11 int j;//点击次数
     12 int a=0,b=0;//贮存鼠标坐标
     13 bool fast,inf;
     14 
     15 IL void selectrate()//选择点击速度、次数
     16 {
     17     while(1)
     18     {
     19         system("cls");
     20         printf("由于windows的最小计时单位为毫秒,故输入大于1000的数字将会被转化为1000,输入0会…会失去等待时间!
    请输入点击频率 n 次/秒
    (0.01< n <=1000)
    ");
     21         cin>>i; 
     22         if(i==0) fast=1;
     23         i=(int)(1000/i);
     24         printf("请输入点击次数 x 次
    ( 0 暗示无限次)
    ");
     25         cin>>j;
     26         if(j==0) inf=1;
     27         break;
     28     }
     29 }
     30 
     31 IL void click(int i,int j)
     32 {
     33     while(1)
     34     {
     35         if(GetAsyncKeyState(VK_SPACE))
     36         {
     37             RE int k=j;
     38             if(inf) k=-1;
     39             printf("运行
    ");
     40             while(k--)//点击次数
     41             {
     42                 if(a&&b)SetCursorPos(a,b);
     43                 mouse_event(MOUSEEVENTF_LEFTDOWN,curpos.x,curpos.y,0,0);
     44                 mouse_event(MOUSEEVENTF_LEFTUP,curpos.x,curpos.y,0,0);
     45                 if(!fast) Sleep(i);
     46                 //锁定目标位置
     47                 if(GetAsyncKeyState(VK_CONTROL))
     48                 {
     49                     if(a&&b)
     50                     {
     51                         a=0;b=0;
     52                         printf("解除锁定
    ");
     53                     }
     54                     else
     55                     {
     56                         GetCursorPos(&curpos);
     57                         a=(int)curpos.x;
     58                         b=(int)curpos.y;
     59                         printf("位置锁定 %d %d
    ",a,b);
     60                     }
     61                 }
     62                 if(GetAsyncKeyState(VK_SPACE))
     63                 {
     64                     printf("暂停
    ");Sleep(100);
     65                     //接收到信号才继续执行
     66                     while(1)
     67                     {
     68                         if(GetAsyncKeyState(VK_SPACE))
     69                         {
     70                             printf("继续
    ");
     71                             break;
     72                         }
     73                         Sleep(100);
     74                         if(GetAsyncKeyState(VK_ESCAPE))
     75                         {
     76                             printf("重新开始
    ");
     77                             return;
     78                         }
     79                     }
     80                 }
     81                 if(GetAsyncKeyState(VK_ESCAPE))
     82                 {
     83                     printf("重新开始
    ");
     84                     return;
     85                 }
     86             }
     87             printf("按空格键再来一次
    ");
     88             while(1)
     89             {
     90                 if(GetAsyncKeyState(VK_SPACE)) break;
     91                 Sleep(200);
     92                 if(GetAsyncKeyState(VK_ESCAPE))
     93                 {
     94                     printf("重新开始
    ");
     95                     return;
     96                 }
     97             }
     98         }
     99     Sleep(250);
    100     }
    101 }
    102 
    103 
    104 int main()
    105 {
    106     system("mode con cols=25 lines=10");
    107     system("title made by S.O.A.F");
    108     SetWindowPos(GetForegroundWindow(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
    109     printf("自动窗口置顶
    空格键开始,暂停,继续
    ESC键重新开始
    4.点击的位置为鼠标的位置。
    CTRL键锁定,解锁位置
    ");
    110     
    111     while(1)
    112     {
    113         fast=inf=0;
    114         system("pause");
    115         selectrate();
    116         system("cls");
    117         printf("频率%.2f次/秒
    次数%d次
    空格键 开始 暂停 继续
    ESC键 重新开始
    CTRL键 锁定 解锁位置
    ",1000/i,j);
    118         click(i,j);
    119     }
    120     return 0;
    121 }

    这里有许多功能。

    窗口置顶

    锁定位置

    中途暂停

    中途启动

    ……

    (但是效率不是特别高)

    在我经过一番测试后,觉得许多功能都是没必要的,就把他们删了。

     1 #include<stdio.h>
     2 #include<stdlib.h>
     3 #include<iostream>
     4 #include<windows.h>
     5 using namespace std;
     6 #define IL inline
     7 #define RE register
     8 POINT curpos;//鼠标的位置
     9 int main()
    10 {
    11     float i;//点击速度
    12     bool fast,flag;
    13     system("mode con cols=25 lines=10");
    14     system("title Code by S.O.A.F");
    15     SetWindowPos(GetForegroundWindow(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
    16     printf("自动窗口置顶
    空格键开始,暂停,继续
    ESC键重新开始
    4.点击的位置为鼠标的位置。
    CTRL键锁定,解锁位置
    ");
    17     
    18     while(1)
    19     {
    20         fast=flag=0;
    21         system("pause");
    22         system("cls");
    23         
    24         printf("由于windows的最小计时单位为毫秒,故输入大于1000的数字将会被转化为1000,输入0会…会失去等待时间!
    请输入点击频率 n 次/秒
    (0.01< n <=1000)
    ");
    25         cin>>i; 
    26         if(i==0) fast=1;
    27         else i=(int)(1000/i);
    28         system("cls");
    29         
    30         printf("频率%.2fHz
    空格键 开始
    ESC键 重新开始
    ",1000/i);
    31         
    32         while(1)//等待空格触发开始 
    33         {
    34             if(GetAsyncKeyState(VK_SPACE))
    35             {
    36                 printf("开始运行
    ");
    37                 while(1)
    38                 {
    39                     if(!fast) Sleep(i);
    40                     mouse_event(MOUSEEVENTF_LEFTDOWN,curpos.x,curpos.y,0,0);
    41                     mouse_event(MOUSEEVENTF_LEFTUP,curpos.x,curpos.y,0,0);
    42                     if(GetAsyncKeyState(VK_ESCAPE))
    43                     {
    44                         printf("重新开始
    ");
    45                         flag=1;
    46                         break;
    47                     }
    48                 }
    49             }
    50             if(GetAsyncKeyState(VK_ESCAPE))
    51             {
    52                 printf("end
    ");
    53                 flag=1;
    54             }
    55             if(flag) break;
    56         }
    57         
    58     }
    59     return 0;
    60 }

    只有短短的六十行!

    还把函数都涵盖到主函数里面了。

    反正,用来给钉钉直播刷赞应该够了吧……

    测试程序

    那要是不刷赞无聊的时候,怎么来测试连点器的性能呢?

    我又翻了翻mouse的一些函数,找到了mouse_event();

     1 #include<windows.h>
     2 #include<cstdio>
     3 #include<iostream>
     4 using namespace std;
     5 
     6 
     7 int main()
     8 {
     9     HANDLE ConsoleWin;
    10     INPUT_RECORD eventMsg;
    11     DWORD Pointer ;
    12     long long a=0;
    13     ConsoleWin = GetStdHandle(STD_INPUT_HANDLE);//Get the console window
    14  
    15     while(1){
    16         ReadConsoleInput(ConsoleWin, &eventMsg, 1, &Pointer);//Read input msg
    17         if (eventMsg.EventType == MOUSE_EVENT && eventMsg.Event.MouseEvent.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED) printf("%lld
    ",++a);
    18     }
    19     return 0;
    20 }

    运行后,点一下控制台就会记录+1。十分方便快捷!

    (记得关闭“快速编辑模式”!)

    ZIP

    这里把所有东西的压缩包放在这了……

  • 相关阅读:
    终端时钟与时钟源偏差40秒异常处理
    (原创)odoo one2many字段以子列表形式显示
    (原创)odoo动态设置树形视图中的字段,每个用户可定制自己要显示的字段
    (原创)odoo14下qweb模板的前端与后端语法区别
    nginx安装前奏
    MySQL破解root用户密码
    Docker创建运行多个mysql容器
    判断pcie卡插在哪个cpu上
    虚拟化之Hypervisor
    HCIA-Cloud Computer笔记
  • 原文地址:https://www.cnblogs.com/send-off-a-friend/p/12342090.html
Copyright © 2011-2022 走看看