WIN32鼠标左击事件
WM_LBUTTONDOWN
Syntax
WM_LBUTTONDOWN WPARAM wParam LPARAM lParam;
Parameters
wParam
- Indicates whether various virtual keys are down. This parameter can be one or more of the following values.
lParamMK_CONTROL
- The CTRL key is down.
MK_LBUTTON- The left mouse button is down.
MK_MBUTTON- The middle mouse button is down.
MK_RBUTTON- The right mouse button is down.
MK_SHIFT- The SHIFT key is down.
MK_XBUTTON1- Windows 2000/XP: The first X button is down.
MK_XBUTTON2- Windows 2000/XP: The second X button is down.
- The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.
WIN32鼠标事件
WM_MOUSEWHEEL
Syntax
WM_MOUSEWHEEL WPARAM wParam LPARAM lParam;
Parameters
wParam
- The high-order word indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. The low-order word indicates whether various virtual keys are down. This parameter can be one or more of the following values.
MK_CONTROL
- The CTRL key is down.
MK_LBUTTON- The left mouse button is down.
MK_MBUTTON- The middle mouse button is down.
MK_RBUTTON- The right mouse button is down.
MK_SHIFT- The SHIFT key is down.
MK_XBUTTON1- Windows 2000/XP: The first X button is down.
MK_XBUTTON2- Windows 2000/XP: The second X button is down.
- 注意,这里获取的是屏幕坐标
- lParam
- The low-order word specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen. The high-order word specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen.
Return Value
If an application processes this message, it should return zero.
Remarks
Use the following code to get the information in the wParam parameter:
fwKeys = GET_KEYSTATE_WPARAM(wParam); zDelta = GET_WHEEL_DELTA_WPARAM(wParam);Use the following code to obtain the horizontal and vertical position:
xPos = GET_X_LPARAM(lParam); yPos = GET_Y_LPARAM(lParam);