Home >Operation and Maintenance >Windows Operation and Maintenance >Detailed introduction to keyboard and mouse messages in Win32 SDK Basics (13)

Detailed introduction to keyboard and mouse messages in Win32 SDK Basics (13)

黄舟
黄舟Original
2017-06-06 10:13:013995browse

1. Keyboard messages

1. Keyboard messages

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

2. Message parameters:

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

3. Use of messages:

(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.

2. Mouse messages

1. Basic mouse messages

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

1.1 Message parameters

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 messages

Generally, 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 message

WM_LBUTTONDBLICLK——Double-click the left mouse button

WM_RBUTTONDBLICLK——Double-click the right mouse button

2.1 Message parameters

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 message

WM_MOUSEWHEEL——Mouse wheel message

3.1 Message Parameter

WMPARAM —— 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn