Article ID: 86835 - Last Review: July 11, 2005 - Revision: 1.3 How To Define Private Messages for Application UseThis article was previously published under Q86835 SUMMARY
In the Microsoft Windows environment, an application can define a private
message for its own use without calling the RegisterWindowMessage API.
Message numbers between 0x8000 and 0xBFFF are reserved for this purpose.
For Windows NT and Windows 95, the system defines a new message WM_APP (value 0x8000). Applications can make use of the range WM_APP through 0xBFFF for private messages without conflict. The only requirement is that the .EXE file must be marked version 4.0 (use the linker switch /subsystem:windows,4.0). Windows NT 3.5 and 3.51 and Windows 95 will run applications marked version 4.0. MORE INFORMATION
The WM_APP constant is used by applications to help define private message, usually of the from WM_APP + X, where X is an integer value. WM_APP is defined in winuser.h as #if(WINVER >= 0x0400) #define WM_APP 0x8000 #endif /* WINVER >= 0x0400 */
Message Number Description
--------------------------------------------------------------------
0 through WM_USER-1 Messages reserved for use by Windows.
WM_USER through 0x7FFF Integer messages for use by private window
classes.
WM_APP through 0xBFFF Messages available for use by applications.
0xC000 through 0xFFFF String messages for use by applications.
Greater than 0xFFFF Reserved by Windows for future use.
To avoid this inconvenience, messages between 0x8000 and 0xBFFF were redefined to make them available to an application. Messages in this range do not conflict with any other messages in the system. The distinction here is that WM_USER messages are specific to a window class (whether it is a control or a user-defined class), while WM_APP messages are not. While WM_USER messages can be treated as application messages, the danger in doing so is that if any are already pre-defined for a particular window class, they could be misinterpreted upon receipt. | Article Translations
|
Back to the top
