I have a Regurlar MFC DLL. The DLL is called from an MFC app using early binding (library and header included in app compile). I would like the client to select from options presented in a dialog generated from within the DLL. In this case, the dialog is called by the DLL code and NOT by the client code.

I've tried this. It compiles but crashes with error:
Code:
	AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
	CTestDlg dlg(AfxGetMainWnd());
	dlg.DoModal();
with error code in objcore.cpp:
Code:
BOOL CObject::IsKindOf(const CRuntimeClass* pClass) const
{
==>	ENSURE(this != NULL);
	// it better be in valid memory, at least for CObject size
	ASSERT(AfxIsValidAddress(this, sizeof(CObject)));

	// simple SI case
	CRuntimeClass* pClassThis = GetRuntimeClass();

	ENSURE(pClassThis);
	return pClassThis->IsDerivedFrom(pClass);
}
What's going on here?