我自定义了一个树形列表,但下面的OnLButtonDown事件怎么样都不会响应。只有父窗口可以接收到点击事件,但这个子控件接收不到,所以我要怎么写才能接收到事件呢?
class CTreeWidget : public CTreeViewCtrl
{
public:
CTreeWidget(void) = default;
~CTreeWidget(void);
BOOL PreTranslateMessage(MSG* pMsg)
{
return CWindow::IsDialogMessage(pMsg);
}
// 消息映射
BEGIN_MSG_MAP(CXmlTreeWidget)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
END_MSG_MAP()
LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
::MessageBox(NULL, NULL, NULL, MB_OK);
}
};