Introduction to the Mouse and Cursor
Except for textual data, the mouse is the preferred form of input. The
movement of the mouse is used to control the movement of the cursor.
The cursor gives the user a visual cue to what will happen when they click
the mouse buttons.
Mouse messages
The mouse hardware itself can give only two kinds of information, movement
and mouse button clicks. These are translated into Windows messages. The
messages received by a window depends on where the hot point
of the cursor is located.
As stated elsewhere, each window has both a client
and a nonclient area. If the hot point of the cursor is located in the
nonclient area, nonclient mouse messages are posted to the window. For
introductory purposes, we will ignore them.
If the hot point of the cursor is located in the
client area, some of the messages received by the window include the following.
Mouse movement:
WM_MOUSEMOVE
Left and right mouse buttons:
WM_LBUTTONUP
WM_LBUTTONDOWN
WM_LBUTTONDBLCLK
WM_RBUTTONUP
WM_RBUTTONDOWN
WM_RBUTTONDBLCLK
Middle mouse button (only if Windows is 3-button aware):
WM_MBUTTONUP
WM_MBUTTONDOWN
WM_MBUTTONDBLCLK
Cursor (mouse) coordinates
Strictly speaking, there is no such thing as a mouse coordinate -- only
cursor coordinates. However, it's easy to make this mistake because the
mouse messages include coordinate information.