这个可以有多个方法的,如mouse_event等,直接用SendMessage也是可以的以下方法可以说与编译器无关(用dev-cpp或其它开发工具都可以)用的是原生态windows的SDK在100,200位置左击鼠标#include<windows.h>constintDX=100;constintDY=200;intmain(){INPUT*buffer=newINPUT[3];buffer->type=INPUT_MOUSE;buffer->mi.dx=static_cast<long>(65535.0f/(GetSystemMetrics(SM_CXSCREEN)-1)*DX);buffer->mi.dy=static_cast<long>(65535.0f/(GetSystemMetrics(SM_CYSCREEN)-1)*DY);;buffer->mi.mouseData=0;buffer->mi.dwFlags=(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE);buffer->mi.time=0;buffer->mi.dwExtraInfo=0;(buffer+1)->type=INPUT_MOUSE;buffer->type=INPUT_MOUSE;buffer->mi.dx=static_cast<long>(65535.0f/(GetSystemMetrics(SM_CXSCREEN)-1)*DX);buffer->mi.dy=static_cast<long>(65535.0f/(GetSystemMetrics(SM_CYSCREEN)-1)*DY);;(buffer+1)->mi.mouseData=0;(buffer+1)->mi.dwFlags=MOUSEEVENTF_RIGHTDOWN;(buffer+1)->mi.time=0;(buffer+1)->mi.dwExtraInfo=0;(buffer+2)->type=INPUT_MOUSE;buffer->type=INPUT_MOUSE;buffer->mi.dx=static_cast<long>(65535.0f/(GetSystemMetrics(SM_CXSCREEN)-1)*DX);buffer->mi.dy=static_cast<long>(65535.0f/(GetSystemMetrics(SM_CYSCREEN)-1)*DY);;(buffer+2)->mi.mouseData=0;(buffer+2)->mi.dwFlags=MOUSEEVENTF_RIGHTUP;(buffer+2)->mi.time=0;(buffer+2)->mi.dwExtraInfo=0;SendInput(3,buffer,sizeof(INPUT));delete(buffer);return0;}