Messages and Message Queues

Both Windows CE and applications use messages to communicate with windows. Although messages are generally used to notify a window of particular events, some messages cause the window to perform an action.

Messages consist of a message identifier and optional parameters. The term "message" is used to mean either the message identifier or the identifier and the parameters together. The specific meaning is usually clear from the context.

A message identifier is a named constant that identifies a message. When a window procedure receives a message, it uses a message identifier to determine how to process the message. For example:

WM_CREATE is sent to a window when it is created.

WM_DESTROY is sent to a window when it is destroyed.

WM_PAINT is sent to a window when the window's client area has changed and must be repainted.

Message parameters contain data or the location of data that a window procedure will use to process the message. The meaning and value of the message parameters depend on the message identifier. A message parameter can contain an integer, packed bit flags, a pointer to a structure containing additional data, or other information. A window must check the message identifier to determine how to interpret the message parameters.