Friday, December 19, 2003

WTL Control - message reflection

If you have a wtl control (like a CListViewCtrl or a CTreeViewCtrl) and you want to handle notify messages into that class, you should have something like this in you message map:

BEGIN_MSG_MAP(CDeriveListViewCtrl)

        REFLECTED_NOTIFY_CODE_HANDLER(LVN_COLUMNCLICK, OnColumnClick)

        DEFAULT_REFLECTION_HANDLER()

END_MSG_MAP()

LRESULT OnColumnClick(int idCtrl, LPNMHDR pNmh, BOOL& bHandled);

 

it is important that you didn't specify REFLECT_NOTIFICATIONS, otherwise messages will be sent to the wrong window.

 

No comments: