代码如下:
#include<iostream>
#include<windows.h>
#include<conio.h>
#define sys system("cls")
using namespace std;
void hello(){
cerr<<"连点器\n";
Sleep(1000);
sys;
}
int main(){
char q='a';
char w;
hello();
while(1){
cout<<"((1)切换)连点键:"<<q;
cout<<"\n连点键盘按o\n连点鼠标按a\n";
cin>>w;
switch(w){
case '1':
sys;
q=getch();
cerr<<q;
break;
case 'o':
sys;
cerr<<"多少下:";
int e;
cin>>e;
for(int i=0;i<e;i++){
keybd_event(q,0,0,0);//按下q
keybd_event(q,0,2,0);//抬起q
Sleep(2);
}
break;
case 'a':
cerr<<"多少下:";
int r;
cin>>r;
for(int i=0;i<r;i++){
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);//模拟鼠标键按下
Sleep(5);//要留给某些应用的反应时间
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);//模拟鼠标键抬起
Sleep(5);
}
break;
}
sys;
}
}
不喜勿喷!
希望在座的各位给我点个赞,这个程序也是我这个新手打了二十多分钟才打好的。
谢谢大家能看到最后