
Dialog app without main dialog
Quote:
> Olaf,
> Why not send along your code that launches the dialog?
Because I though it wouldn't be necessary.
But here it is:
BOOL CXCCModLauncherApp::InitInstance()
{
// Standard initialization
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
xcc_dirs::load_from_registry();
CXCCModLauncherDlg dlg;
m_pMainWnd = &dlg;
const char* xmlf_filter = "XMLF files (*.xmlf)|*.xmlf|";
CFileDialog file_dlg(true, NULL, 0, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST,
xmlf_filter, NULL);
if (IDOK == file_dlg.DoModal())
{
dlg.set_mod_fname(static_cast<string>(file_dlg.GetPathName()));
dlg.DoModal();
}
return false;
Quote:
}
> Cecil
> --
> Cecil A. Galbraith
> http://www.codesoup.com
> Programmers Tips and Tricks
> > Hi,
> > I have a dialog based app that should only run when the user opens a
file.
> > I do this with CFileDialog.
> > If the user presses Ok I do dlg.DoModal(), otherwise I don't.
> > But the app crashes in release mode after pressing Cancel, while it
works
> > fine in debug mode.
> > What could be wrong?
> > --
> > Olaf van der Spek
> > Almere, Holland
> > http://xcc.tiberian.com/