Windows消息:WM_USER与WM_APP的区别
2018-01-18 00:31
701 查看
Windows消息范围及意义
#define WM_USER 0x0400#define WM_APP 0x8000
0到WM_USER-1
Messages reserved for use by the system
系统预留使用的消息
WM_USER到0x7FFF
Integer messages for use by private window classes
被私有窗口类使用的消息
WM_APP到0xBFFF
Messages available for use by applications
被应用程序使用的消息
0xC000到0xFFFF
String messages for use by applications
被应用程序使用的字符串消息
大于0xFFFF
Reserved by the system
系统预留
WM_USER与WM_APP的区别
WM_USER到0x7FFF:仅在自己预定义的窗口内部使用
WM_APP到0xBFFF:
在应用程序的其他地方均可使用
注意:这只是一种约定俗成的规则,约定只是best practice,并不是说你不这么做就一定会出问题.
如果程序的所有窗口和所有控件完全由你一个人实现,你完全可以不遵守这一规则.
但若有其他人写的代码或加载了外来的控件,如果你不遵守这一规则,发生冲突的概率会明显加大,可能会出现意想不到的结果.
RegisterWindowMessage
The RegisterWindowMessage function defines a new window message that is guaranteed to be unique throughout the system.The message value can be used when sending or posting messages.
UINT RegisterWindowMessage(LPCTSTR lpString)
The RegisterWindowMessage function is typically used to register messages for communicating between two
cooperating applications.
If two different applications register the same message string, the applications return the same message value.
The message remains registered until the session ends.
Only use RegisterWindowMessage when more than one application must process the same message.
If the message is successfully registered,
the return value is a message identifier in the range 0xC000 through 0xFFFF.
http://blog.csdn.net/hisinwang/article/details/45771711
相关文章推荐
- Windows消息:WM_USER与WM_APP的区别
- Windows 消息综述/WM_USER/WM_APP
- 消息WM_USER和WM_APP
- 详解Windows消息分类以及WM_COMMAND与WM_NOTIFY的区别,以及模拟发送控件通知消息
- Windows消息WM_USER、WM_APP的区别
- 详解Windows消息分类以及WM_COMMAND与WM_NOTIFY的区别,以及模拟发送控件通知消息
- WM_USER 与 WM_APP的区别。。。
- windows消息值全部定义,从消息值得到消息名称(系统消息定义从0到1023,从1024开始就是WM_USER,但是中间有325个WM_undefined消息,估计是备用,另外各控件都有一些reserved消息,也是为了备用)LostSpeed
- Windows消息:WM_USER与WM_APP的区别
- WM_CREATE和WM_INITDIALOG消息响应函数之区别,以及MFC应用程序中处理消息的
- WM_USER 和 WM_APP(VC菜鸟学习记)
- WM_COMMAND和WM_NOTIFY消息的区别
- WM_CLOSE,WM_QUIT,WM_DESTROY消息的区别
- 键盘消息WM_KEYDOWN/WM_KEYUP、WM_SYSKEYDOWN/WM_SYSKEYUP与字符消息WM_CHAR的区别
- GetMessage和PeekMessage的区别及PostMessage(hWnd, WM_QUIT, 0, 0)消息
- WM_INITDIALOG与WM_CREATE消息的区别
- WM_INITDIALOG与WM_CREATE消息的区别
- windows变成点滴(八)之关闭消息WM_CLOSE,WM_QUIT,WM_QUIT
- 【转】Windows消息投递流程:一般窗口消息投递(WM_LBUTTONCLICK)
- Windows 编程[7] - WM_CREATE 消息