Improving MFC for Windows Vista - The Open/Save Dialog
(Page 3 of 4 )
One of the most impressive changes made to Vista that you’ll observe once you get to mess around a little is the improved Explorer. With it there are also some more stylish and practical open/save dialogs.
In MFC you can pop up these kinds of dialogs by simply declaring a CFileDialog type and calling its DoModal() function. So implementing this can be done on the fly and resolved by the container. Once you recompile an older solution with the new one you’ll automatically replace the old ones with the more stylish/practical ones.
To maintain compatibility with older applications and still leave a path for the user to choose which one to use, the solution was to simply extend the constructor in the new library with a extra parameter that signals whether or not to use the Vista style open dialog.
explicit CFileDialog(BOOL bOpenFileDialog,
LPCTSTR lpszDefExt = NULL,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
LPCTSTR lpszFilter = NULL,
CWnd* pParentWnd = NULL,
DWORD dwSize = 0,
BOOL bVistaStyle = TRUE);
So we get the following new Open/Save dialog with a simpler Save As… that initially doesn't show the folder view tree, but lets you choose the save directory by choosing the Browse Folders button.

->Old type open <-

->New type open<-

->Old type Save As <-

->New type Save As <-
Next: Final Thoughts >>
More Windows Scripting Articles
More By Gabor Bernat