自定义消息出错:cannot convert from 'unsigned int CMainFrame::*' to 'unsigned int *'
我想在CMainFrame里面自定义一个消息并处理它
有如下代码:
// MainFrm.h
class CMainFrame : public CFrameWnd
{
private:
UINT m_msgAdd;
protected:
afx_msg LRESULT OnMsgAdd(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
......
};
// MainFrm.cpp
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_REGISTERED_MESSAGE(m_msgAdd, OnMsgAdd)
END_MESSAGE_MAP()
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
......
m_msgAdd=::RegisterWindowMessage("WM_ADDMESSAGE");
}
LRESULT CMainFrame::OnMsgAdd(WPARAM wParam, LPARAM lParam)
{
return 0;
}
编译时出现错误:
MainFrm.cpp(26) : error C2440: 'type cast' : cannot convert from 'unsigned int MainFrame::*' to 'unsigned int *'
There is no context in which this conversion is possible
MainFrm.cpp(26) : error C2440: 'initializing' : cannot convert from 'void (__thiscall CCmdTarget::*)(void)' to 'unsigned int'
Conversion is a valid standard conversion, which can be performed implicitly or by use of static_cast, C-style cast or function-style cast
请问大家是为什么啊?谢谢。