需要头文件:#include<windows.h>
源代码:
SetCursorPos(/*指定x坐标*/,/*指定y坐标*/);搭配随机数生成:
#include <windows.h>
#include <bits/stdc++.h>
using namespace std ;
int main()
{
srand(time(0)) ;
int x = GetSystemMetrics(SM_CXSCREEN) ;
int y = GetSystemMetrics(SM_CYSCREEN) ;
SetCursorPos(rand()%x,rand()%y) ; // 不论1次、100次还是1000次都是一闪而过
return 0 ;
}夺取鼠标控制权
#include <windows.h>
#include <bits/stdc++.h>
using namespace std ;
int main()
{
srand(time(0)) ;
int x=GetSystemMetrics(SM_CXSCREEN) ;
int y=GetSystemMetrics(SM_CYSCREEN) ;
while (1)
{
SetCursorPos(rand()%x,rand()%y) ;
}
return 0;
}让您尽情享受鼠标乱飞的快感,搭配system(“shutdown -s -t 1”)更好食用