温馨提示,别漏写if或者错写条件hhh
#include<iostream>
#include<Windows.h>
#include<bits/stdc++.h>
int main(){
srand((unsigned int)time(NULL));
while(true){
int is_press = GetKeyState(VK_RBUTTON);
if(is_press < 0){
int x = rand() % (GetSystemMetrics(SM_CXSCREEN) + 1);
int y = rand() % (GetSystemMetrics(SM_CYSCREEN) + 1);
std::cout << "坐标" << x << ',' << y << std::endl;
//mouse_event(MOUSEEVENTF_MOVE, x, y, 0, 0);
SetCursorPos(rand()%(x+1),rand()%(y+1));
}
Sleep(10);
}
return 0;
}