c++ 鼠标控制
参考链接:https://blog.csdn.net/m0_37537177/article/details/78197220
#include <iostream>
#include <windows.h>
#include <cstdlib>
using namespace std;
int main()
{
char n;
POINT p;
//获取鼠标位置
while(1)
{
GetCursorPos(&p);
cout<<p.x<<" "<<p.y<<endl;
}
SetCursorPos(100,100);//移动到指定位置
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);//按下左键
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);//松开左键
mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0);//按下右键
mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0);//松开右键
return 0;
}