-
March 1st, 2014, 03:43 AM
#1
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.
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();
}
-
March 1st, 2014, 03:51 AM
#2
Re: mfc dll crash
Is it a regular MFC DLL? Then have a look at AfxGetStaticModuleState
BTW, Why do you use an empty method
Code:
void CQBClass::Start()
{
//AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
}
Victor Nijegorodov
-
March 1st, 2014, 04:59 PM
#3
Re: mfc dll crash
AFX_MANAGE_STATE works in function scope only. This is why calling it in a separate function makes no sense.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|