鼠标左键连点器!
本帖最后由 Cool_Breeze 于 2020-8-28 10:20 编辑/*
@ BY COOL_BREEZE
@ 2020/08/28
@ GCC .C
*/
#include<stdio.h>
#include<windows.h>
typedef unsigned char uchar;
typedef unsigned int uint;
void click(uchar count, uchar interval); // 连点函数
int main()
{
uint interval = 0xA; // 每秒点击间隔
uchar count = 0x0; // 每次点击鼠标左键后鼠标点左键击次数
uchar on = 0x0; // 开关
printf("\n鼠标左键连点器! 按 F7 开启 / 暂停\n\n");
printf("当前设置点击一次 触发:%d\n", count);
printf("请先设置点击一次鼠标左键,触发频率!");
printf("请输入次数(一个正整数):");
scanf("%d", &count);
printf("触发频率为:%d\n", count);
while(1)
{
// GetAsyncKeyState 返回一个有符号的 short
// short 高位为 1表示按下按键
if(GetAsyncKeyState(VK_F7) & 0x8000)
{
printf("连点器开启中\n");
on = 0x1;
Sleep(200); // 检查速度太快了!键盘反应不过来
}
if (on)
{
while (1)
{
if(GetAsyncKeyState(VK_LBUTTON) & 0x8000)
{
//printf("\r点击了左键");
click(count, interval) ;
printf("左键点击完成\n");
Sleep(50);
}
if(GetAsyncKeyState(VK_F7) & 0x8000)
{
printf("连点器已经暂停\n");
on = 0x0;
Sleep(200);
break;
}
}
}
}
return 0;
}
void click(uchar count, uchar interval)
{
uchar i = 0x0;
while (i < count)
{
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);
Sleep(interval);
i ++ ;
}
} 测试页面
https://www.5vmc.com/cps.html
页:
[1]