System-Defined Messages
The system sends or posts a system-defined message when it communicates with an application. It uses these messages to control the operations of applications and to provide input and other information for applications to process. An application can also send or post system-defined messages. Applications generally use these messages to control the operation of control windows created by using preregistered window classes.
Each system-defined message has a unique message identifier and a corresponding symbolic constant (defined in the SDK header files) that states the purpose of the message. For example, the WM_PAINT constant requests that a window paint its contents.
Symbolic constants specify the category to which system-defined messages belong. The prefix of the constant identifies the type of window that can interpret and process the message. Following are the prefixes and their related message categories.
Prefix | Message category |
---|---|
ABM | Application desktop toolbar |
BM | Button control |
CB | Combo box control |
CBEM | Extended combo box control |
CDM | Common dialog box |
DBT | Device |
DL | Drag list box |
DM | Default push button control |
DTM | Date and time picker control |
EM | Edit control |
HDM | Header control |
HKM | Hot key control |
IPM | IP address control |
LB | List box control |
LVM | List view control |
MCM | Month calendar control |
PBM | Progress bar |
PGM | Pager control |
PSM | Property sheet |
RB | Rebar control |
SB | Status bar window |
SBM | Scroll bar control |
STM | Static control |
TB | Toolbar |
TBM | Trackbar |
TCM | Tab control |
TTM | Tooltip control |
TVM | Tree-view control |
UDM | Up-down control |
WM | General window |
General window messages cover a wide range of information and requests, including messages for mouse and keyboard input, menu and dialog box input, window creation and management, and dynamic data exchange (DDE).
Application-Defined Messages
An application can create messages to be used by its own windows or to communicate with windows in other processes. If an application creates its own messages, the window procedure that receives them must interpret the messages and provide appropriate processing.
Message-identifier values are used as follows:
- The system reserves message-identifier values in the range 0x0000 through 0x03FF (the value of WM_USER – 1) for system-defined messages. Applications cannot use these values for private messages.
- Values in the range 0x0400 (the value of WM_USER) through 0x7FFF are available for message identifiers for private window classes.
- If your application is marked version 4.0, you can use message-identifier values in the range 0x8000 (WM_APP) through 0xBFFF for private messages.
- The system returns a message identifier in the range 0xC000 through 0xFFFF when an application calls the RegisterWindowMessage function to register a message. The message identifier returned by this function is guaranteed to be unique throughout the system. Use of this function prevents conflicts that can arise if other applications use the same message identifier for different purposes.