日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

Windows消息:WM_USER与WM_APP的区别

發布時間:2025/3/12 windows 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Windows消息:WM_USER与WM_APP的区别 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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.

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的Windows消息:WM_USER与WM_APP的区别的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。