Reputation: 63806
CListCtrl has a CHeaderCtrl 'built-in' and we want to override it with something customized, i.e a class which derives from CHeaderCtrl.
What's the best/correct way to do this, assuming we have a dialog CMyDlg which contains a CListCtrl m_List, and a custom header CCustomHeader.
Upvotes: 2
Views: 2258
Reputation: 308452
You should be able to call CWnd::SubclassWindow from your CCustomHeader member variable.
m_Header.SubclassWindow(m_List.GetHeaderCtrl()->GetSafeHwnd());
Upvotes: 1
Reputation: 3636
Derive a class from CListCtrl
and implement the handlers for the notification messages you need. The messages are named with LVN_ for messages about the list control and its items, and also HDN_ for things about the header control.
Upvotes: 0