- C++
C++连点器
- 2023-1-1 20:04:05 @
#include <bits/stdc++.h> #include <windows.h> using namespace std;
#define START (GetKeyState(VK_MENU)<0) #define STOP (GetKeyState(VK_SPACE)<0) #define END (GetKeyState(VK_ESCAPE)<0) #define SET (GetKeyState('S')<0&&GetKeyState('E')<0&&GetKeyState('T')<0)
void go(int,int); void color(int);
void setpinl();
void weikaishi(); void dianjizhong(); void shezhizhong(); void jieshu();
int pinl=10; int times=0;
int main() { system("mode con cols=40 lines=10");
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
SetWindowPos(GetForegroundWindow(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
SetConsoleTitle("连点器");
color(15);
go(1,1);
cout<<"按下[Alt]开始点击";
go(1,2);
cout<<"按下[Space]暂停点击";
go(1,3);
cout<<"同时按下[S][E][T]更改频率: "<<pinl<<"次/s ";
go(1,4);
cout<<"按下[Esc]退出程序";
go(1,7);
cout<<"当前状态:";
while(!START)
{
Sleep(100);
weikaishi();
if(SET)
{
setpinl();
weikaishi();
}
if(END)
{
jieshu();
return 0;
}
}
dianjizhong();
while(!END)
{
if(STOP)
{
weikaishi();
while(!START)
{
if(SET)
{
setpinl();
weikaishi();
}
if(END)
{
jieshu();
return 0;
}
Sleep(100);
}
dianjizhong();
}
if(SET)
{
setpinl();
dianjizhong();
}
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
Sleep(500/pinl);
mouse_event(MOUSEEVENTF_LEFTUP ,0,0,0,0);
Sleep(500/pinl);
times++;
}
jieshu();
return 0;
}
void setpinl() { shezhizhong();
CONSOLE_CURSOR_INFO cursor_info={1,1};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);标
go(15,3);
color(8);
cout<<"(请输入)";
go(15,3);
color(15);
pinl=0;
char a;
a=getchar();
while(a!='\n')
{
if(a<='9'&&a>='0')
pinl=pinl*10+(a-'0');
a=getchar();
}
CONSOLE_CURSOR_INFO cursor_info2={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info2);
if(pinl>500)
{
setpinl();
return;
}
go(1,3);
cout<<"同时按下[S][E][T]更改频率: "<<pinl<<"次/s ";
}
void weikaishi() { go(6,7); color(175);cout<<"未开始点击"; } void dianjizhong() { go(6,7); color(79);cout<<"点击中"; color(15);cout<<" "; } void shezhizhong() { go(6,7); color(159);cout<<"设置频率中"; }
void jieshu() { go(6,7); color(240); cout<<"程序结束"; color(15); cout<<" ";
go(1,8);
color(15);
cout<<"共点击"<<times<<"次"<<endl<<" ";
color(8);
system("pause");
}
void go(int x,int y)
{
COORD coord;
coord.X=x*2;
coord.Y=y;
HANDLE a=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(a,coord);
}
void color(int a)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
3 条评论
-
万叶 (汪奕晨) LV 7 @ 2023-7-4 20:59:36
c++我看不懂!
我看的懂这什么玩意儿啊!!! -
2023-1-3 20:45:43@
???(lll¬ω¬)
-
2023-1-1 21:10:44@
这个讨论是什么意思?
- 1