//windows下获得鼠标位置和控制鼠标:
#include <iostream>
#include <windows.h>
#include <cstdlib>
using namespace std;
int main()
{
char n;
POINT p;
//获取鼠标位置
while((n=getchar())!='\n')
{
GetCursorPos(&p);
system("cls");//包含在cstdlib中
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);//松开右键
}