RegisterWindowMessage

Syntax

WORD RegisterWindowMessage(lpString)

This function defines a new window message that is guaranteed to be unique throughout the system. The returned message value can be used when calling the SendMessage or PostMessage function.

RegisterWindowMessage is typically used for communication between two cooperating applications.

If the same message string is registered by two different applications, the same message value is returned. The message remains registered until the user ends the Windows session.

Parameter Type/Description  

lpString LPSTR Points to the message string to be registered.  

Return Value

The return value specifies the outcome of the function. It is an unsigned short integer within the range 0xC000 to 0xFFFF if the message is successfully registered. Otherwise, it is zero.

Comments

Use the RegisterWindowMessage function only when the same message must be understood by more than one application. For sending private messages within an application, an application can use any integer within the range WM_USER to 0xBFFF.