Message Types

Windows CE supports both system-defined messages and application-defined messages. System-defined messages have message identifiers ranging from 0 to 0x3ff. Messages with message identifiers ranging from 0x400 to 0x7fff are available for application-defined messages.

There are two types of system-defined messages: General window messages, which are used for all windows, and special purpose messages, which apply to a particular class of windows. General window messages cover a wide range of information and requests, including messages for stylus and keyboard input and window creation and management.

The prefix of the symbolic constant for the message generally identifies the category to which the message belongs. For example, general window messages all start with WM, whereas messages that apply only to button controls start with BM.

Message types supported by Windows CE are described in the following table.

Message prefix Description
BM Button message
BN Button notification
CB Combo box message
CBN Combo box notification
CDM Common dialog box message
CDN Common dialog box notification
CPL Control panel message
DB Object store message
DM Dialog box default push button message
DTM Date time picker and HTML viewer messages
DTN Date time picker notification
EM Edit control message
EN Edit control notification
HDM Header control message
HDN Header control notification
IMN Input context message
LB List box control message
LBN List box notification
LINE Line device message
LVM List view message
LVN List view notification
MCM Month calender message
MCN Month calendar notification
NM Messages sent by a variety of controls
PBM Progress bar message
PSM Property sheet message
PSN Property sheet notification
RB Rebar message
RBN Rebar notification
SB Status bar window message
SBM Scroll bar message
STM Static bar message
STN Static bar notification
TB Toolbar message
TBM Trackbar message
TBN Trackbar notification
TCM Tab control message
TCN Tab control notification
TVM Tree view message
TVN Tree view notification
UDM Up-down control message
UDN Up-down control notification
WM General window messages

You may define your own messages for use by your own windows. If you create your own messages, be sure that the window procedure that receives them interprets and processes them correctly. The operating system makes no attempt to interpret application-defined messages.

In some situations, you need to use messages to communicate with windows that are controlled by other processes. In this situation, you call the RegisterWindowMessage function to register a message identifier. The message number returned by this function is guaranteed to be unique throughout the system. By using this function, you prevent the conflicts that can arise if different applications use the same message identifier for different purposes.

Windows CE defines a WM_HIBERNATE message to notify an application when system resources are running low. When an application receives this message, it should attempt to release as many resources as possible. Every Windows CE program that uses even moderate amounts of system resources should implement a handler for the WM_HIBERNATE message.

Note If an application's window is not visible, it cannot receive a WM_HIBERNATE message. This is because the WM_HIBERNATE message is only sent to applications that have a button on the taskbar, which only visible windows do. A window that is hidden will not get this message, even if it is a top-level, overlapped window.

Windows CE does not support hooking messages because the extra processing required by hooks could seriously degrade the performance of Windows CE-based devices.