描述:
写了一个IE的工具条toolband插件,在工具条上有dropdown按钮,点击会向父窗口发送TBN_DROPDOWN的消息,我想直接在CToolBar派生的类中处理该消息,用了ON_NOTIFY_REFLECT(TBN_DROPDOWN, OnDropDown)和ON_NOTIFY_REFLECT_EX(TBN_DROPDOWN, /*BOOL*/OnDropDown)处理,但是不成功,应该怎么做?
我的消息映射只是在头文件里加入
DECLARE_MESSAGE_MAP()
和在cpp里加入
BEGIN_MESSAGE_MAP(CWSLIEToolBar, CToolBar)
ON_NOTIFY_REFLECT_EX(TBN_DROPDOWN, OnDropDown)
END_MESSAGE_MAP()
不知对不对
解决方案1:
再ON_NOTIFY_REFLECT_EX(TBN_DROPDOWN, OnDropDown)
解决方案2: // We need to create a reflection window in between our toolbar control
// and the rebar in order to get WM_COMMAND messages sent from the toolbar to its
// parent.
if (!m_wndReflectionWnd.Create(NULL, NULL, WS_CHILD, rcClientParent, pWndParent, 0))
return false;
if (!m_wndToolBar.Create(rcClientParent, &m_wndReflectionWnd, this))
return false;