N
nbrau
Guest
Hi all,
I wrote a regular dll with mfc/c++ that contains a modeless dialog.
When I use the dll in an mfc project, at the very end I have a crash and the only info I have is: Run-Time Check Failure # 2 - Stack around the variable dlg was corrupted.
I solicit your help to find the problem ... because I confess to be completely lost, it is about 2 whole days that I test all informations found on Google, but no solution currently. I suppose it comes from the code of the DLL, on the dialog side where its badly managed.
I give you the link to download the sources of the DLL and the project to test it: Downloading the project for Visual Studio 2015
Thank you very much, I have to use it for a demo Monday in the morning ...:
For those who do not download, here is a preview of the code:
Test application :
Ctest_dllDlg dlg;
// m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
return FALSE; // Ca plante ici
}
Dialog in test application :
// "Variable" modeless dialog from the dll
CDExVad m_validation;
Modeless dialog creation in the DLL :
CDExVad::CDExVad() //:
//m_gui(new CGui)
{
m_gui = new CGui();
m_FlagVad = 1;
if (m_FlagVad == 1)
{
m_parent = NULL;
// Creation of our gui dialog
AFX_MANAGE_STATE(AfxGetStaticModuleState());
BOOL ret = m_gui->Create(MAKEINTRESOURCE(IDD_DIALOG1));
m_gui->ShowWindow(SW_SHOW);
// Setting the dialog text in CSV format
m_gui->m_EditBox.SetWindowText(_T("hhmmss;methodname;value\r\n"));
InitGuiDlg();
SetGuiPosition();
}
}
Dialog destruction in the DLL :
CDExVad::~CDExVad()
{
ASSERT_VALID(m_gui);
m_gui->DestroyWindow();
}
And in the dialog class :
void CGui:ostNcDestroy()
{
CDialogEx:ostNcDestroy();
delete this;
}
Continue reading...
I wrote a regular dll with mfc/c++ that contains a modeless dialog.
When I use the dll in an mfc project, at the very end I have a crash and the only info I have is: Run-Time Check Failure # 2 - Stack around the variable dlg was corrupted.
I solicit your help to find the problem ... because I confess to be completely lost, it is about 2 whole days that I test all informations found on Google, but no solution currently. I suppose it comes from the code of the DLL, on the dialog side where its badly managed.
I give you the link to download the sources of the DLL and the project to test it: Downloading the project for Visual Studio 2015
Thank you very much, I have to use it for a demo Monday in the morning ...:
For those who do not download, here is a preview of the code:
Test application :
Ctest_dllDlg dlg;
// m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
return FALSE; // Ca plante ici
}
Dialog in test application :
// "Variable" modeless dialog from the dll
CDExVad m_validation;
Modeless dialog creation in the DLL :
CDExVad::CDExVad() //:
//m_gui(new CGui)
{
m_gui = new CGui();
m_FlagVad = 1;
if (m_FlagVad == 1)
{
m_parent = NULL;
// Creation of our gui dialog
AFX_MANAGE_STATE(AfxGetStaticModuleState());
BOOL ret = m_gui->Create(MAKEINTRESOURCE(IDD_DIALOG1));
m_gui->ShowWindow(SW_SHOW);
// Setting the dialog text in CSV format
m_gui->m_EditBox.SetWindowText(_T("hhmmss;methodname;value\r\n"));
InitGuiDlg();
SetGuiPosition();
}
}
Dialog destruction in the DLL :
CDExVad::~CDExVad()
{
ASSERT_VALID(m_gui);
m_gui->DestroyWindow();
}
And in the dialog class :
void CGui:ostNcDestroy()
{
CDialogEx:ostNcDestroy();
delete this;
}
Continue reading...