ON_MESSAGE和ON_REGISTERED_MESSAGE

来源:互联网 发布:云客服绩效计算软件 编辑:程序博客网 时间:2024/06/05 11:42

ON_REGISTERED_MESSAGE

检举|2008-08-20 17:41zuowen2008 | 分类:VC++ | 浏览2592次
使用 ON_REGISTERED_MESSAGE 定义一个消息处理函数,但是编译总过不了ON_REGISTERED_MESSAGE(m_OverLoadMessage, OnOverLoad)OnOverLoad 的定义为:afx_msg LRESULT OnOverLoad(WPARAM wParam, LPARAM lParam);
我有更好的答案
提问者采纳
2008-08-20 18:38
ON_REGISTERED_MESSAGE是注册消息映射宏,原型如下;ON_REGISTERED_MESSAGE(nMessageVariable, memberFxn )nMessageVariable注册的Windows消息ID变量memberFxn消息处理函数名检查你的m_OverLoadMessage是否是Window注册消息变量。应该这样定义此变量static UINT NEAR WM_OVER_LOAD = RegisterWindowMessage(_T("OVER_LOAD"));宏和函数声明为ON_REGISTERED_MESSAGE(WM_OVER_LOAD, OnOverLoad) afx_msg LRESULT OnOverLoad(WPARAM wParam, LPARAM lParam);



ON_MESSAGE和ON_REGISTERED_MESSAGE

on_message用于处理一切消息,但是on_registered_message只用处理在系统已经注册过的消息。 
The RegisterWindowMessage function is used to define a new window message that is guaranteed to be unique throughout the system. The macro ON_REGISTERED_MESSAGE is used to handle these messages. This macro accepts a name of a UINT NEAR variable that contains the registered windows message ID.


原创粉丝点击