With the code below, the File Save dialog is displayed as expected, with two buttons: Save and Cancel. Clicking Cancel returns with result=IDCANCEL
, but clicking Save or typing Enter does not return from DoModal
, just repaints the Filename window. Is there any reason the Save button should not work?
// Code below is in a message handler of a modeless dialog
CString defaultExt, filter;
defaultExt = "fits";
filter = "FITS image Files (*.fits)|*.fits|All image files (*.img; *.fits)|*.img; *.fits|All Files (*.*)|*.*||";
CFileDialog dlg(FALSE/*save as*/, defaultExt, "GeneratedImage", OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST, filter, this);
int result = (int)dlg.DoModal(); // does not return if Save is clicked
The behavior is the same if the optional argument of CFileDialog
is bVistaStyle=FALSE
.
Visual Studio 2019 v16.7.7, 32-bit debug build, built on and running on 64-bit Windows 7 (same result running on 64-bit Windows 10).