Wm_user and wm_app

Source: Internet
Author: User


For more information, see Baidu encyclopedia.



The wm_user constant is used by windows to help applications define private messages in the private window class. Generally, wm_user + is used as an integer, but the total value cannot exceed 0x7fff.

# Define wm_user 0x0400
 
Wm_user is defined in winuser. h.

Range Representation
 
0 ~ WM_USER-1
Messages retained by the operating system.
 
Wm_user ~ 0x7fff
The integer message used by the private window class.
 
Wm_app ~ 0 xbfff
Message used by the application.
 
0xc000 ~ 0 xFFFF
String message used by the application.
 
0 xFFFF ~
Messages retained by the operating system. Bottom of the form
 

MFC pre-defines some common control bars in afxres. h.

# Define afx_idw_toolbar 0xe800 // main toolbar for window

# Define afx_idw_status_bar 0xe801 // status bar window

# Define afx_idw_preview_bar 0xe802 // printpreview dialog bar

# Define afx_idw_resize_bar 0xe803 // OLE in-place resize bar

# Define afx_idw_rebar 0xe804 // comctl32 "rebar" Bar

# Define afx_idw_dialogbar 0xe805 // cdialogbar
 



Wm_user and wm_app# What are the differences between define wm_get (wm_user + 112) and # define wm_get (wm_app + 112?(1) wm_user through 0x7fff integer messages for use by private window classes. wm_app through 0 xbfff messages
Available for use by applications.
(2) the default rule is wm_user + x (wm_user -- 0x7fff) for window-level messages, and wm_app + x (wm_app -- 0 xbfff) for process-level messages.(3) My understanding: the first definition is used for in-process messages, and the second definition is used for inter-process messages.(4) a conventional rule.
Wm_user through 0x7fff: used only in a pre-defined window;
Wm_app through 0 xbfff: available elsewhere in the Application
Example 1:If you implement all the windows and controls of the program by yourself, you can not follow this rule.
However, if someone else writes code or loads external controls, if you do not follow this rule, the probability of a conflict increases significantly and unexpected results may occur.
Example 2:In this case, a notification message needs to be defined in my com to notify the application to buffer it. This COM is a COM in the process, when I # define wm_get (wm_user + 112) passed the test for 30 times, the test may fail once. Use # define
Wm_get (wm_app + 112) is successful for 30 times, but it cannot be caused by it now. It may be affected elsewhere.


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.