VC++模拟鼠标源码
//前台
mouse_event(MOUSEEVENTF_MOVE,100,100,0,GetMessageExtraInfo());//移动
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,GetMessageExtraInfo());//按下
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,GetMessageExtraInfo());//松开
//后台消息模拟鼠标
int x,y;
x=255;
y=53;
::SendMessage(hwnd, WM_LBUTTONDOWN, MK_LBUTTON,MAKELPARAM (x, y));
Sleep(20);
::SendMessage(hwnd, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(x,y));
::SendMessage(hwnd, WM_LBUTTONDOWN, NULL, 0);// 发送鼠标按下消息
::SendMessage(hwnd, WM_LBUTTONUP, NULL, 0); // 发送鼠标弹起消息
页:
[1]