Subclassing a header control to CListCtrl
Posted on 2002-06-13
I have a CListCtrl in which I want to replace its CHeaderCtrl to CMyHeaderCtrl. The CListCtrl is created at run-time using create method (not from the resources).
I tried the following code:
int CMyListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
if (CListCtrl::OnCreate(lpCreateStruct) == -1)
m_MyHeader.SubclassDlgItem( 0, this);
This works fine if the CListCtrl is created with WS_VISIBLE style, but unfortunatelly I need it to be created not-visible, and if the WS_VISIBLE style is not set on the creation then the SubclassDlgItem does not succeeded.
I also checked in spy++ that the header-ctrl is not exist after CListCtrl::OnCreate exits.
Can someone please advise ??