Win32 Windows Programming VI

Source: Internet
Author: User

WM_PAINT message

1 WM_PAINT A WM_PAINT message is generated due to the window's mutual coverage, and so on, resulting in areas that need to be drawn. In general, do not send WM_PAINT messages directly, through API declaration need to draw area to produce

WM_PAINT message

For example, you can use InvalidateRect to declare a region that needs to be redrawn

BOOL InvalidateRect (  hwnd  hwnd,           //Handle to Window  lpRect ,   Rectangle coordinates  BOOL  bErase          //Erase state);
2 wm_paint points of attention2.1 If there is more than one WM_PAINT message in a message queue, only the last message has a role2.2 WM_PAINT message processing, empty the area that needs to be drawn. Use of BeginPaint3 WM_PAINT3.1 WM_PAINT must be called at the beginning BeginPaint3.2 Wm_paint must be called at the end of the EndPaint
Keyboard messages

1 keyboard messages

Key message

Wm_keydown occurs when the key is pressed

Wm_keyup Occurs when a key is released

Wm_syskeydown (ALT/F10) occurs when the system key is pressed

Wm_syskeyup occurs when the System key is released

Character message

Wm_char occurs when a character key is pressed

TranslateMessage will convert the keys that can be displayed in the WM_KEYDOWN message into WM_CHAR messages

2 Message Parameters

WPARAM-Virtual Key code

LPARAM-related key information

3 Use of messages

3.1 When there is a key message, first enter the system message queue and then be retrieved by the program's message loop

3.2 Handling of messages

4 Order of keyboard messages

For the characters that can be displayed: Wm_keydown wm_char wm_keyup

For non-display characters: Wm_keydown wm_keyup

For system keys: Wm_syskeydown Wm_keyup

If the key has not been released, it will repeat

Wm_keydown (Wm_keychar)






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.