#include<iostream>
#include<windows.h>
#include <thread>
#include <functional>
using namespace std;
void thMoveMouse()
{
POINT p;
while (1) {
GetCursorPos(&p);//获取鼠标坐标
std::cout << p.x << " " << p.y << std::endl;
SetCursorPos(1350, 16);//更改鼠标坐标
//SetPhysicalCursorPos(p.x - 300, p.y - 300);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);//按下左键
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);//松开左键
Sleep(1000);
GetCursorPos(&p);//获取鼠标坐标
std::cout << p.x << " " << p.y << std::endl;
SetCursorPos(615, 879);//更改鼠标坐标
//SetPhysicalCursorPos(p.x + 300, p.y + 300);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);//按下左键
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);//松开左键
Sleep(1000);//控制移动时间间隔
}
}
int main()
{
thread thLeft(thMoveMouse);
thLeft.join();
return 0;
}