鼠标单击C ++

时间:2012-07-07 23:10:14

标签: c++ windows-7 click mouse mouseevent

无论如何在我的应用程序之外使用C ++强制鼠标单击?例如,如果鼠标位于某个坐标中,则强制它单击。

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:1)

试试这个:

HWND h = (hwnd of window)
WORD mouseX = 10;// x coord of mouse
WORD mouseY = 10;// y coord of mouse
PostMessage(hWnd,WM_LBUTTONDOWN,0,MAKELPARAM(mouseX,mouseY));

取自this site