- oldPoint,newPoint:POINT
- GetCursorPos(&oldPoint); //保存当前鼠标位置。
- newPoint.x = oldPoint.x+40;
- newPoint.y = oldPoint.y+10;
- SetCursorPos(newPoint.x,newPoint.y); //设置目的地位置。
- mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0);//模拟按下鼠标右键。
- mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0);//模拟放开鼠标右键。
- mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);//模拟按下鼠标左键。
- mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);//模拟放开鼠标左键。
- keybd_event(VK_SHIFT,MapVirtualKey(VK_SHIFT,0),0,0); //按下SHIFT键。
- keybd_event(0x52,MapVirtualKey(0x52,0),0,0);//按下R键。
- keybd_event(0x52,MapVirtualKey(0x52,0),KEYEVENTF_KEYUP,0);//放开R键。
- keybd_event(VK_SHIFT,MapVirtualKey(VK_SHIFT,0),KEYEVENTF_KEYUP,0);//放开SHIFT键。
- SetCursorPos(oldPoint.x,oldPoint.y);
参考CSDN。
|