Visual C++ and MFC Fundamentals Chapter 5: The Document/View Architecture
- Return to MSVC
4.5.3 The Mouse-Up Messages...................................................................
After pressing a mouse button, the user usually releases it. While the button is being
released, a button-up message is sent and it depends on the button, left or right, that was
down.
If the left mouse is being released, the ON_WM_LBUTTONUP message is sent. Its
syntax is:
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
If the right mouse is being released, the ON_WM_TBUTTONUP message is sent. Its
syntax is:
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
The first argument, nFlags, specifies what button, right or middle, is down or what
keyboard key and what mouse button were down. It is a constant integer that can have
one of the following values:
Value Description
MK_CONTROL A Ctrl key was held down
MK_MBUTTON The middle mouse button was down
MK_RBUTTON The right mouse button was down
MK_SHIFT A Shift key was held
The point argument specifies the measure from the (0, 0) origin of the window to the
mouse pointer.
Practical Learning: Sending a Mouse Down Message
- To experiment with a mouse up message, change the program as follows:
#include <afxwin.h>