此黑科技支持空格、英文字母
代码如下(手动滑稽):
1 #include<conio.h> 2 #include<stdio.h> 3 #include<string.h> 4 #include<windows.h> 5 int n,slp; 6 char g[1000],sp[20]; 7 int main(){ 8 SetConsoleTitle("刷屏"); 9 puts("-多少毫秒发送一条消息呢?"); 10 printf("-"); scanf("%d",&slp); 11 puts("-刷几次呢?"); 12 printf("-"); scanf("%d",&n); 13 puts("-刷屏内容的表达式(仅支持英文)(%n表示计数器)"); 14 printf("-"); scanf("%c",&g[0]); scanf("%[^\n]",&g); 15 puts("-准备就绪!请在10秒内切换至所需刷屏的窗口!"); 16 Sleep(10000); 17 puts("-刷屏开始!"); 18 for(int i=1;i<=n;i++){ 19 memset(sp,0,sizeof(sp)); 20 for(int j=0;j<strlen(g);j++){ 21 if(g[j]>=‘a‘&&g[j]<=‘z‘){ 22 keybd_event(g[j]-‘a‘+‘A‘,0,0,0); 23 keybd_event(g[j]-‘a‘+‘A‘,0,2,0); 24 } 25 if(g[j]>=‘A‘&&g[j]<=‘Z‘){ 26 keybd_event(VK_SHIFT,0,0,0); 27 keybd_event(g[j],0,0,0); 28 keybd_event(g[j],0,2,0); 29 keybd_event(VK_SHIFT,0,2,0); 30 } 31 switch(g[j]){ 32 case ‘ ‘:{keybd_event(VK_SPACE,0,0,0);keybd_event(VK_SPACE,0,2,0);break;} 33 } 34 if(g[j]==‘%‘&&g[j+1]==‘n‘){ 35 sprintf(sp,"%d",i); 36 for(int k=0;;k++){ 37 if(sp[k]==‘\0‘) break; 38 keybd_event(sp[k],0,0,0); 39 keybd_event(sp[k],0,2,0); 40 } 41 j++; 42 } 43 } 44 keybd_event(VK_CONTROL,0,0,0); 45 keybd_event(‘V‘,0,0,0); 46 keybd_event(VK_CONTROL,0,2,0); 47 keybd_event(‘V‘,0,2,0); 48 keybd_event(VK_RETURN,0,0,0); 49 keybd_event(VK_RETURN,0,2,0); 50 Sleep(slp); 51 } 52 }
时间: 2024-10-22 02:30:13