if you register a callback function to your window, CV_EVENT_MBUTTONDOWN is one of the events you can get here ( the 1st param in that function ) maybe you try to run the little test-program below, and just see, what happens ;)
void onmouse( int event, int x, int y, int d, void *p )
{
cout << event << " " << x << " " << y << " " << d << endl;
if ( event == CV_EVENT_MBUTTONDOWN ) cout << "middle!" << endl;
}
int main()
{
VideoCapture cap(0); // 1st cam
Mat frame;
namedWindow("video", 1);
cv::setMouseCallback( "video", onmouse );
for(;;) {
cap >> frame;
if(frame.empty()) break;
imshow("video", frame);
if(waitKey(30) >= 0) break;
}
return 0;
}