-
mfc dll crash
a MFC dll using ActiveX control, consider the case when the content of Start() is uncommented, and within OpenDialog(), AFX_MANAGE_STATE(AfxGetStaticModuleState( )); is commented. In this case the MFC dll crashes when executing the dlg.DoModal();. Otherwise it works ok. not certain why?.Start() is called first. :confused:
Code:
BOOL CQBDllApp::InitInstance()
{
AfxOleInit();
AfxEnableControlContainer();
CoInitialize(NULL);
return CWinApp::InitInstance();
}
void CQBClass::Start()
{
//AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
}
void CQBClass::OpenDialog()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
dlg.DoModal();
}
-
Re: mfc dll crash
Is it a regular MFC DLL? Then have a look at AfxGetStaticModuleState
BTW, Why do you use an empty method
Quote:
Code:
void CQBClass::Start()
{
//AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
}
:confused:
-
Re: mfc dll crash
AFX_MANAGE_STATE works in function scope only. This is why calling it in a separate function makes no sense.