Home > Article > Operation and Maintenance > Detailed introduction to keyboard and mouse messages in Win32 SDK Basics (13)
WM_KEYDOWN - generated when a keyboard key is pressed.
WM_KEYUP - generated when the keyboard key pops up.
WM_SYSKEYDOWN —— Generated when the system key is pressed, such as ALT, F10, etc.
WM_SYSKEUP —— Generated when the system is released
WM_CHAR —— Character message
Key message:
WPARAM - VirtualKey of the key
LPARAM - Key parameters, such as the number of times pressed
WM_CHAR:
WPARAM - Input characters (ASCII encoding)
LPARAM ——Relevant parameters of the button
(1) KEYDOWN can repeat the message, KEYUP can only appear once when the key is released
(2) When TranslateMessage converts the WM_KEYDOWN message, WM_CHAR can be generated for visible characters, but there is no such message for invisible characters.
WM_LBUTTONDOWN——The left mouse button is pressed
WM_LBUTTONUP —— The left mouse button bounces up
WM_RBUTTONDOWN ——The right mouse button is pressed
WM_RBUTTONUP — — Right mouse button pops up
WM_MOUSEMOVE ——Mouse move message
WMPARAM ——The state of other keys, such as Ctrl/Shift, etc.
##LPARAM ——The position of the mouse, the window client area Coordinate System.
LOWORD X coordinate position
HIWORD Y coordinate position
1.2 Use of mouse messagesGenerally, mouse press/move up appears in pairs. During mouse movement, a series of WM_MOUSEMOVE messages will be generated according to the movement speed.
2. Double-click the messageWM_LBUTTONDBLICLK——Double-click the left mouse button
WM_RBUTTONDBLICLK——Double-click the right mouse button
WMPARAM ——The status of other keys, such as Ctrl/Shift, etc.
LPARAM ——Mouse The position, the coordinate system of the window client area.
LOWORD X coordinate position
HIWORD Y coordinate position
You need to be in the registration window when using it When adding the CS_DBLCLS style to the class, the order of message generation:
WM_LBUTTONDOWN
WM_LBUTTONUP
WM_LBUTTONDBLCLK
WM_LBUTTONUP
3. Wheel messageWM_MOUSEWHEEL——Mouse wheel message
3.1 Message ParameterWMPARAM —— The status of other buttons
HIWORD —— The offset of the scroll wheel, which is a multiple of 120, through the positive and negative poles Indicates the direction of scrolling.
Positive: scroll forward
Negative: scroll backward
LRARAM: Mouse current Position, screen coordinate system:
LOWORD X coordinate position
HIWORD Y coordinate position
The above is the detailed content of Detailed introduction to keyboard and mouse messages in Win32 SDK Basics (13). For more information, please follow other related articles on the PHP Chinese website!