MFC/C++: a hwnd related assertion failure is caused when I copy an existing dialog resource for another CDialog class
Posted on 2007-11-21
I've created a new CDialog derived class, which is similar to an existing one. I copied the existing Dialog resource for my new CDialog derived class, and added new objects for the dialog's widgets, which don't necessarily have the same name as the old objects.
The dialog executes, until I attempt to call any of the object's member functions, which causes various assertion/ensure failures:
This occurs when I attempt to call a CEdit's CWnd::SetWindowTextA(), for example:
void CWnd::SetWindowText(LPCTSTR lpszString)
ENSURE(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL)); // this is the offending line
if (m_pCtrlSite == NULL)
I'm unsure what has gone wrong. Please help!