|
When I used CFileDialog in MFC Dialog Project, it ran correctly. But when CFileDialog is used in DLL Projects(MFC Dll and Win32 Dll) it didn't run.
In detail, DoModal() function didn't run. program stopped.
Please Help me.
Thank you for reading my question.
|
|
|
|
|
LeeUnSong wrote: program stopped. You need to provide more detail than this, we cannot guess what your code is doing.
|
|
|
|
|
Thank you for your kindness. sorry for my poor english.
I created project with "Regular Dll with MFC statically linked".
Then I added new class "CMainDlg" to project. Of course, this class has resource "IDD_MAINDLG".
I put button control on my dialog and made event function "CMainDlg::OnBnClickedOpenfile".
After that, I added code as follow.
void CMainDlg::OnBnClickedOpenfile()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CFileDialog OpenDlg(TRUE);
if (OpenDlg.DoModal() != IDOK)
{
AfxMessageBox("Clicked Cancel");
return;
}
AfxMessageBox("Clicked OK");
}
Build my project and loaded my dll file from other project.
Then MainDlg appeared.
But after clicking "OpenFile" button, no messagebox appeared.
What is wrong in my code???
|
|
|
|
|
LeeUnSong wrote: What is wrong in my code? I am not sure. The best solution is to use your debugger to step through the code and check what happens at each line.
|
|
|
|