//重要提醒:作者应保证自身贡献不低于GenAI的贡献
//WS_EX_NOACTIVATE 不会夺取焦点 惊天发现
//重要提醒:作者应保证自身贡献不低于GenAI的贡献
//WS_EX_NOACTIVATE 不会夺取焦点 惊天发现
#include<windows.h>
#include<bits/stdc++.h>
#define tab VK_TAB
#define space ' '
#define mouse_l VK_LBUTTON
#define mouse_r VK_RBUTTON
#define mouse_m VK_MBUTTON
#define shift VK_SHIFT
#define control VK_CONTROL
#define scstab SetConsoleTextAttribute
#define gsh GetStdHandle
#define soh STD_OUTPUT_HANDLE
#define fgis FOREGROUND_INTENSITY
#define lp key(mouse_l)
using namespace std;
queue<double>q;
double s,maxc,cps,mode;
const string dc="cyan";
const string pc="violet";
bool ac,keyflag=1,changeac,cases[20];
int on=2,pf,cclear,sf;
POINT pos;
double clickspeed=10.0;
POINT curpos;
namespace std{ //所有常量
const int poss[][5]={{11,45,14},
{60,75,129,127},{130,75,182,127},{183,75,240,127},{241,75,297,127},
{298,75,353,127},{354,75,410,127},{60,140,145,190},{146,140,202,190},
{203,140,258,190},{259,140,314,190},{315,140,370,190},{60,200,123,255},
{124,200,415,255}
};
const int keycol[114]={0,6,15,22,29,36,43,6,17,24,31,38,6,14,58,62,64};
const int keyrow[514]={0,2,2,2,2,2,2,6,6,6,6,6,10,10,6,6,6};
const string printid[114]={"L","tab","q","w","e","t","p","shift","a","s","d","c","ctrl","space"};
const int mouses[514]={mouse_l,mouse_m,mouse_r};
map<string,int>m={
{"tab",VK_TAB},{"q",'Q'},{"w",'W'},{"e",'E'},{"t",'T'},{"p",'P'},
{"a",'A'},{"shift",VK_SHIFT},{"s",'S'},{"d",'D'},{"c",'C'},
{"ctrl",VK_CONTROL},{"space",VK_SPACE}
};
const string mouseimage[50]={
"___________",
"| | | |",
"| | | |",
"| | | |",
"| |_| |",
"| |",
"| CPS |",
"| |",
"|_________|"
};
const string image[][5]={{},
{"_________","| |","| TAB |","|_______|"}, //1
{"_______","| |","| Q |","|_____|"}, //2
{"_______","| |","| W |","|_____|"}, //3
{"_______","| |","| E |","|_____|"}, //4
{"_______","| |","| T |","|_____|"}, //5
{"_______","| |","| P |","|_____|"}, //6
{"___________","| |", //7
"| SHIFT |","|_________|"},
{"_______","| |","| A |","|_____|"}, //8
{"_______","| |","| S |","|_____|"}, //9
{"_______","| |","| D |","|_____|"}, //10
{"_______","| |","| C |","|_____|"}, //11
{"________","| |","| CTRL |","|______|"}, //12
{"_____________________________________", //13
"| |",
"| SPACE |",
"|___________________________________|"},
{" "," "," "," "},{" "," "," ","_"},{" "," "," "," "}
};
const string acimage[]={" Autoclick:Left "," Autoclick:Right ",
" Autoclick:Close ","Autoclick:L-rand","Autoclick:R-rand"};
};
bool key(int i){
return GetAsyncKeyState(i)&0x8000;
}
void scroll_ing(bool f){//1是上,2是下
if(!key(shift)) return;
if(f) clickspeed*=1.067;
else clickspeed/=1.067;
if(clickspeed>500) clickspeed=500;
if(clickspeed<0.1) clickspeed=0.1;
}
void scroll_check() {//开始检测鼠标滚轮滚动
HHOOK hook = SetWindowsHookEx(WH_MOUSE_LL, [](int nCode, WPARAM wParam, LPARAM lParam) {
if(nCode >= 0 && wParam==WM_MOUSEWHEEL) {
short delta = GET_WHEEL_DELTA_WPARAM(((MSLLHOOKSTRUCT*)lParam)->mouseData);
scroll_ing(delta>0);
}
return CallNextHookEx(NULL, nCode, wParam, lParam);
}, NULL, 0);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
UnhookWindowsHookEx(hook);
}
POINT getpos(){//获取鼠标位置
HWND hwnd = GetConsoleWindow();
SetWindowLongPtr(hwnd, GWL_EXSTYLE,
GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_NOACTIVATE);
HWND consoleHWND = GetConsoleWindow();
RECT rect;
POINT ret;
if (GetWindowRect(consoleHWND, &rect)) {
ret.x=rect.left;
ret.y=rect.top;
curpos.x=rect.left;
curpos.y=rect.top;
}
return ret;
}
void presskey(int keyCode) { //按下某个按键并松开
keybd_event(keyCode, 0, 0, 0);
keybd_event(keyCode, 0, KEYEVENTF_KEYUP, 0);
}
void go(int col,int line){//光标去到某位置
COORD p;
p.X=col;
p.Y=line;
SetConsoleCursorPosition(GetStdHandle(soh),p);
}
void color(int in_front_of,int behind=0){//调整颜色
//0 = 黑色 2 = 绿色 14 = 淡黄色 15 = 亮白色
WORD wColor=((behind&0x0F)<<4)+(in_front_of&0x0F);
SetConsoleTextAttribute(GetStdHandle(soh),wColor);
}
void setcolor(string str){//调整字体颜色
if(str=="lightblue") scstab( gsh(soh),fgis|1);
if(str=="lightred") scstab( gsh(soh),fgis|FOREGROUND_RED);
if(str=="violet") scstab(gsh(soh), fgis | FOREGROUND_RED | FOREGROUND_BLUE);
if(str=="cyan") scstab(gsh(soh), fgis | FOREGROUND_GREEN | FOREGROUND_BLUE);
if(str=="blue") scstab( gsh(soh),FOREGROUND_BLUE);
if(str=="red") scstab( gsh(soh), FOREGROUND_RED);
if(str=="yellow") scstab(gsh(soh), FOREGROUND_RED | FOREGROUND_BLUE);
else return;
}
void back_keyboard(){ //绘制键盘底板
setcolor(dc);
for(int i=5;i<=13;i++){
go(57,i);
cout<<mouseimage[i-5];
}
color(2,0);
for(int i=1;i<=14;i++){
go(3,i);
for(int j=1;j<=51;j++) cout<<" ";
cout<<"\n";
}
go(0,1);
setcolor("violet");
cout<<" 这是一个好东西,按F9调整连点模式,按F10打开屏幕键盘";
go(0,15);cout<<" 连点器使用指南:按Shift+滚动鼠标滚轮 调整点击速度:>";
setcolor("violet");
go(46,7); cout<<"作者:";
go(46,8); cout<<"tttyyygdgz";
go(46,9); cout<<"daniel08";
}
void init(){// 初始化
//步骤1:禁止焦点监测(点击时不获得焦点)
HWND hwnd = GetConsoleWindow();
SetWindowLongPtr(hwnd, GWL_EXSTYLE,
GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_NOACTIVATE);
//步骤2:设置窗口大小和位置
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
system("mode con cols=73 lines=17");
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(gsh(soh),&cursor_info);
HWND hWnd=GetForegroundWindow();
LONG style=GetWindowLong(hWnd,GWL_EXSTYLE);
SetWindowLong(hWnd,GWL_EXSTYLE,style|WS_EX_TOPMOST);
// SetWindowPos(hWnd,HWND_TOPMOST,0,GetSystemMetrics(SM_CYFULLSCREEN)-230,0,0,SWP_NOSIZE);
SetWindowPos(hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE);
//步骤3:取消快速编辑
HANDLE hStdin=GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(hStdin,&mode);
mode&=~ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(hStdin,mode);
}
bool checkpos(int x1,int y1,int x2,int y2){// 检查鼠标位置
GetCursorPos(&pos);
POINT Winpos=curpos;
int x=pos.x-Winpos.x;
int y=pos.y-Winpos.y;
if(x>=x1&&x<=x2&&y>=y1&&y<=y2){
return 1;
}
return 0;
}
bool pcases[15];
void getpress(){//获得键盘按下情况
memset(pcases,0,sizeof pcases);
for(int i=1;i<=13;i++){
pcases[i]=key(m[printid[i]]);
}
}
void getmouse(){//获得鼠标按下情况
memset(cases,0,sizeof(cases));
for(int i=1;i<=13;i++){cases[i]=checkpos(poss[i][0],poss[i][1],poss[i][2],poss[i][3]);}
}
void printkey(int row,int col,const string str[]){//行row,列col
go(row,col);
for(int i=0;i<4;i++){
string linestr=str[i];
cout<<linestr;
go(row,++col);
}
}
void Main(){// 次主程序
while(1){
Sleep(10);//降低侦测速度,试试删除它会发生什么
getpos();//获取鼠标位置
getmouse();//获得键盘按下情况
getpress();
for(int i=1;i<=16;i++){
bool fl=((cases[i]&&lp)||pcases[i]);
setcolor(dc);
if(i<=13) setcolor(fl?pc:dc);
else (key(mouses[i-14])?color(0,13):setcolor(dc));
printkey(keycol[i],keyrow[i],image[i]);
if(fl&&i<=13){
pf=m.find(printid[i])->second;
}
}
setcolor(pc);
go(41,1);cout<<((!sf)?"打开":"关闭");
cclear=(checkpos(485,270,535,290)&&key(mouse_l));
go(60,15);setcolor(cclear?pc:dc);
cout<<"[清除]";
while(clock()-q.front()>1511&&!q.empty()) q.pop();
setcolor(pc);go(59,12);
cps=q.size()/1.511;
if(cps<10){printf(" %03.1lf ",cps);}
else if(cps>=10&&cps<100){printf(" %02.1lf ",cps);}
else if(cps>=100&&cps<1000){printf(" %.0lf ",cps);}
else printf(" %.0lf ",cps);
go(57,14);printf("Max-Cps:%.0lf ",maxc);
go(54,4);cout<<acimage[on];
go(54,3);cout<<"----------------";
go(55,2);cout<<"ClickSpeed:"<<clickspeed<<" ";
maxc=max(maxc,cps);
}
}
void click(int fast,int mode){// copyright 点击
int cd=(mode==0||mode==1)?(fast>>1):(fast?(rand()%fast):0);//非常不错的冷却计算器
DWORD down=((mode==0||mode==3)?MOUSEEVENTF_LEFTDOWN:MOUSEEVENTF_RIGHTDOWN);
DWORD up=((mode==0||mode==3)?MOUSEEVENTF_LEFTUP:MOUSEEVENTF_RIGHTUP);
mouse_event(down,0,0,0,0);
int r=rand()%((cd/3)+1);
Sleep(r%2==0?(cd-r):(cd+r));
mouse_event(up,0,0,0,0);
q.push(clock());
Sleep(r%2?(cd-r):(cd+r));
}
bool f9=0,close;
void runAC(){ //运行连点器 (run auto-clicker)
while(1){
Sleep(20);
if(key(VK_F9)){
while(key(VK_F9));
on=(on+1)%5;
}
if(key(VK_F10)){
while(key(VK_F10));
sf=!sf;
}
ac=0;
while(key(mouse_m)){
double cal=(1.0/clickspeed*1000);
if(on!=2) click(clickspeed==500?0:(int)cal,on);
}
}
}
void move(int x,int y){SetCursorPos(x,y);}
void click_check(){ //点击速度的计算(检测点击
while(1){
Sleep(10);
if(key(mouse_l)||key(mouse_r)||key(mouse_m)){
while((key(mouse_l)||key(mouse_r)||key(mouse_m)));
q.push(clock());
}
}
}
void softkeyboard(){//软键盘
while(1){
Sleep(10);
if(pf!=-1){
if(sf){
keybd_event(pf,0,0,0);
keybd_event(pf,0,KEYEVENTF_KEYUP,0);
while(key(mouse_l));
pf=-1;
}else pf=-1;
}
if(cclear!=0){
while(key(mouse_l));
Sleep(10);
while(q.size())q.pop();
maxc=0;
cclear=0;
}
}
}
#define run main //迷惑行为
signed run(){
cout<<setprecision(3);
init();
back_keyboard();//_MWD_.Run();
thread t1(Main),t2(runAC),t3(scroll_check),t4(click_check),t5(softkeyboard);
t1.join();t2.join();t3.join();t4.join();t5.join();
}
//int main(){run();return 0;}
[$\boxed{\text{top}}$](#top)键盘 V2.1
这是 2025年11月21日 存档的第 1 版,不是当前版本。查看当前版本