直接上代码。。。
#include <windows.h>
#include <ctime>
using namespace std;
int main(void)
{
int x=GetSystemMetrics(SM_CXSCREEN); //设定鼠标x坐标
int y=GetSystemMetrics(SM_CYSCREEN); //设定鼠标y坐标
srand(time(0)); //时间
while (true)
{ //重复执行
SetCursorPos(rand()%x,rand()%y); //随机坐标,让鼠标乱窜
}
return 0;
}