Polecam MSDN Library - tam jest wszystko i nie tytlko o MFC!!
Zobacz CFileDialog::CFileDialog
This constructor creates an instance of a standard Windows CE file dialog box-object. Either a Open or Save As dialog box is constructed, depending on the value of bOpenFileDialog.
The following code example demonstrates how to use CFileDialog to rename or move an existing file dialog box. My Documents and docs are directories and new file is the new name of the file dialog box.
CFileDialog dlg(FALSE, NULL, TEXT("\\My Documents\\docs\\new file"),
OFN_PROPERTY);
The following code example demonstrates how to use CFileDialog to create a new file dialog box.
CFileDialog dlg(TRUE, NULL, NULL, OFN_PROJECT);
CFileDialog(
BOOL bOpenFileDialog,
LPCTSTR lpszDefExt = NULL,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
LPCTSTR lpszFilter = NULL,
CWnd* pParentWnd = NULL);
Parameters
bOpenFileDialog
Set to TRUE to construct a File Open dialog box or FALSE to construct a File Save As dialog box.
lpszDefExt
Specifies the default filename extension. If the user does not include an extension in the filename edit box, the extension specified by lpszDefExt is automatically appended to the filename. If this parameter is NULL, no file extension is appended.
lpszFileName
Specifies the initial filename that appears in the filename edit box. If NULL, no filename initially appears.
dwFlags
Specifies a combination of one or more flags that allow you to customize the dialog box. For a description of these flags, see the OPENFILENAME structure. If you modify the m_ofn.Flags structure member, use a bitwise-OR operator in your changes to keep the default behavior intact.
lpszFilter
Specifies a series of string pairs that specify filters you can apply to the file. If you specify file filters, only selected files will appear in the Files list box. See the Remarks section for more information on how to work with file filters.
pParentWnd
Specifies a pointer to the parent or owner window of a file dialog-box object.
Remarks
The lpszFilter parameter is used to determine the type of filename a file must have to be displayed in the file list box. The first string in the string pair describes the filter; the second string indicates the file extension to use. Multiple extensions may be specified using a semicolon (

as the delimiter. The string ends with two vertical bar (||) characters, followed by a NULL character. You can also use a CString object for this parameter.
For example, Microsoft Excel permits users to open files with extensions .XLC (chart) or .XLS (worksheet), among others. The filter for Excel could be written as:
static char BASED_CODE szFilter[] = "Chart Files (*.xlc)|*.xlc|Worksheet Files (*.xls)|*.xls|Data Files (*.xlc;*.xls)|*.xlc; *.xls|All Files (*.*)|*.*||";
Note, however, that if you plan to use this string to directly update the OPENFILENAME structure, you should delimit your strings with the null character, (\0), instead of the vertical bar (|).