Bootstrap

C++Windows连点器制作

直接上代码

#include<windows.h>
#include<cstdio>
using namespace std;

#define Down(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1 : 0)

int time=5;

int main()
{
    while(1)
    {
        if(Down(VK_F1))//按F1设置点击间隔
        {
            int x;
            printf("time:");
            scanf("%d",&x);//等待用户键入
            if(x>0)time=x;
        }
        if(Down(VK_LSHIFT))//按左shift200ms开始连点
        {
            Sleep(200);
            while(Down(VK_LSHIFT))
            {
                mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);//模拟单击
                Sleep(time);//延时
            }
        }
        Sleep(20);
    }
    return 0;
}

Down()的参数可以参考虚拟键码 (Winuser.h) - Win32 apps | Microsoft Learn

程序思路没啥好说的,注释应该够明白了吧

;