
filtered open file dialog
// Create a file dialog box to get file selection from user.
CString FileFilter = CString("txt files (*.txt)|*.txt")
+ CString("All files (*.*)|*.*||");
CFileDialog FileDlg ( TRUE, NULL, NULL,
OFN_PATHMUSTEXIST | OFN_HIDEREADONLY,
FileFilter);
// Control the settings and behavior of the dialog box
// by editing the OPENFILENAME structure it uses.
FileDlg.m_ofn.lpstrTitle = "Open Your File";
// Open the file dialog box and get the filename
if ( FileDlg.DoModal() != IDOK ) { return; };
CString Fname = FileDlg.GetPathName();
Quote:
> could someone please give me some example code for a CFileDialog that
> will open files, and that has a filter?
> thx alot!