如何定义Windows消息范围

本文介绍了WM_APP消息常量的用途及其在应用程序中如何帮助定义私有消息。详细解释了WM_APP与其他消息范围的区别,包括系统保留消息、私有窗口类整数消息、应用程序可用消息及注册字符串消息等。

WM_APP Notification


The WM_APP constant is used by applications to help define private messages, usually of the form WM_APP+X, where X is an integer value.

Syntax

#define WM_APP       0x8000

Return Value

No return value.

Remarks

The WM_APP constant is used to distinguish between message values that are reserved for use by the system and values that can be used by an application to send messages within a private window class. The following are the ranges of message numbers available.

RangeMeaning
0 through WM_USER–1Messages reserved for use by the system.
WM_USER through 0x7FFFInteger messages for use by private window classes.
WM_APP through 0xBFFFMessages available for use by applications.
0xC000 through 0xFFFFString messages for use by applications.
Greater than 0xFFFFReserved by the system.

Message numbers in the first range (0 through WM_USER–1) are defined by the system. Values in this range that are not explicitly defined are reserved by the system.

Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.

Message numbers in the third range (0x8000 through 0xBFFF) are available for application to use as private messages. Message in this range do not conflict with system messages.

Message numbers in the fourth range (0xC000 through 0xFFFF) are defined at run time when an application calls the RegisterWindowMessage function to retrieve a message number for a string. All applications that register the same string can use the associated message number for exchanging messages. The actual message number, however, is not a constant and cannot be assumed to be the same between different sessions.

Message numbers in the fifth range (greater than 0xFFFF) are reserved by the system.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值