SubclassDlgItem on Property Page: failing on ASSERT
Posted on 2001-08-02
I'm trying to dynamically subclass a field on a property page. The code looks like this:
The SubclassDlgItem() fails on an ASSERT in
BOOL CWnd::Attach(HWND hWndNew)
ASSERT(m_hWnd == NULL); //OK
ASSERT(FromHandlePermanent(hWndNew) == NULL); //fails
FromHandlePermanent returns a non-NULL pWnd, presumbably because the control in question is already in the permanent map.
I've used the same override logic on an edit field in a regular dialog (derived from CDialog rather than CPropertyPage) without any problem. Is there something special about subclassing on a property page? Or can someone point me to something else I am doing wrong?