#include <windows.h>
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
int main() {
// 设置随机数种子
srand(time(0));
// 定义鼠标位置结构体
POINT mouse;
while (true) {
// 获取当前鼠标位置
GetCursorPos(&mouse);
// 随机生成新的鼠标位置
mouse.x = rand() % GetSystemMetrics(SM_CXSCREEN); // 屏幕宽度范围
mouse.y = rand() % GetSystemMetrics(SM_CYSCREEN); // 屏幕高度范围
// 输出新位置到控制台
cout << "Mouse Position: " << mouse.x << ", " << mouse.y << endl;
// 设置鼠标到新位置
SetCursorPos(mouse.x, mouse.y);
// 随机延迟一段时间(0-500毫秒)
Sleep(rand() % 500);
}
return 0;
}