I am developing a computer vision program using OpenCV (IDE = devcpp). I am able to get the hand contour , move cursor position according to our our hand. i want to implement right click functionality开发者_如何学C .Please help me with it .
i am using event SetCursorPos(x,y) to set the cursor position on the screen. is there any simple function to implement rightclick the same way .??
Maybe this will help: http://www.codeguru.com/forum/showthread.php?t=377394
void RightClick ( )
{
INPUT Input={0};
// right down
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_RIGHTDOWN;
::SendInput(1,&Input,sizeof(INPUT));
// right up
::ZeroMemory(&Input,sizeof(INPUT));
Input.type = INPUT_MOUSE;
Input.mi.dwFlags = MOUSEEVENTF_RIGHTUP;
::SendInput(1,&Input,sizeof(INPUT));
}
And to use:
RightClick();
The link shows examples for left clicking, mouse move, etc. too.
精彩评论