博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Windows消息:WM_USER与WM_APP的区别
阅读量:3979 次
发布时间:2019-05-24

本文共 1359 字,大约阅读时间需要 4 分钟。

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://pqhki.baihongyu.com/

你可能感兴趣的文章
计算机发展中的两大“杀手”
查看>>
MDK5(Keil for ARM) 工程建立时遇到的问题集锦
查看>>
Ubuntu下安装GTK+及Glade开发C应用界面
查看>>
assertion 'GTK_IS_WIDGET (widget)' failed的解决办法
查看>>
Ubuntu登录管理员账户时,输入密码后一直在登录界面循环
查看>>
Linux下的定时器以及POSIX定时器:timer_settime()
查看>>
POSIX定时器timer_create()以及线程中的gettid() 和pthread_self()
查看>>
C语言 回调函数
查看>>
c语言swap(a,b)值交换的4种实现方法
查看>>
C++小知识点
查看>>
【转载】zedboard中PL_GPIO控制(8个sw、8个leds)
查看>>
zedboard烧写程序到FLASH,用于QSPI Flash启动
查看>>
软件工程师,你必须知道的20个常识
查看>>
常用STL算法2_查找
查看>>
常用STL算法3_排序
查看>>
常用STL算法4_拷贝和替换
查看>>
STL综合案例
查看>>
O(logn)时间复杂度求Fibonacci数列
查看>>
Iterator_traits
查看>>
Zedboard中的SPI通信记录文档(已实现)
查看>>