search
HomeOperation and MaintenanceWindows Operation and MaintenanceDetailed introduction to keyboard and mouse messages in Win32 SDK Basics (13)

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools