hansenk
asked on
SubclassDlgItem on Property Page: failing on ASSERT
I'm trying to dynamically subclass a field on a property page. The code looks like this:
BOOL CMyPropertyPage::OnInitDia log()
{
CPropertyPage::OnInitDialo g();
m_myedithandler.SubclassDl gItem(IDC_ MYEDIT,thi s);
return TRUE;
}
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?
BOOL CMyPropertyPage::OnInitDia
{
CPropertyPage::OnInitDialo
m_myedithandler.SubclassDl
return TRUE;
}
The SubclassDlgItem() fails on an ASSERT in
BOOL CWnd::Attach(HWND hWndNew)
{
ASSERT(m_hWnd == NULL); //OK
ASSERT(FromHandlePermanent
...
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
-- Dan