Windows Vista redesigned the way the file dialogs look. MFC 9.0 (that will ship with Visual Studio 2008) was updated to support the new look and feel. If you compile your MFC application with VS 2008 you get the new file dialogs with no additional change. On the other hand if you run the application under Win XP the old file dialogs are shown. This is possible because of an additional parameter to the constructor of CFileDialog. The old constructor signature was:
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);
The new constructor in MFC 9.0 has an additional parameter, a BOOL flag indicating whether the Vista dialogs should be displayed of not.
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);
To display the Vista file dialogs, all you have to do is instantiate a CFileDialog object and create the dialog itself:
CFileDialog dlg(TRUE, NULL, NUL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
L"Text files (*.txt)|*.txt||", this);
dlg.DoModal();

You can still use the old file dialog look and feel if you set the last parameter to FALSE:
CFileDialog dlg(TRUE, NULL, NUL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
L"Text files (*.txt)|*.txt||", this, 0, FALSE);
dlg.DoModal();

This old dialog is what you automatically get when running on a previous operating system.









