DWORD dwSize = 0, // The size of theOPENFILENAME structure, 默认为0 ,表示自动确定正确的大小
BOOL bVistaStyle = TRUE );
参数含义详细说明:
[in]
bOpenFileDialog
The parameter that specifies what type of dialog box to create. Set it to TRUE to construct a File Open dialog box. Set it to FALSE to construct aFile Save As dialog box.
[in]
lpszDefExt
The default file name extension. If the user does not include an extension in the Filename box, the extension specified bylpszDefExt is automatically appended to the file name. If this parameter isNULL, no extension is appended.
[in]
lpszFileName
The initial file name that appears in the Filename box. If NULL, no initial file name appears.
[in]
dwFlags
A combination of one or more flags that you can use to customize the dialog box. For a description of these flags, see theOPENFILENAMEstructure in the Windows SDK. If you modify them_ofn.Flags structure member, use a bitwise-OR operator in your changes to keep the default behavior intact.
[in]
lpszFilter
A series of string pairs that specify filters you can apply to the file. If you specify file filters, only files that match filter criteria will appear in the Files list. See the Remarks section for more information about how to work with file filters.
[in]
pParentWnd
A pointer to the parent or owner window of the file dialog box.
[in]
dwSize
The size of the OPENFILENAME structure. This value depends on the operating system version. MFC used this parameter to determine the appropriate kind of dialog box to create (for example, new Windows 2000 dialog boxes instead of NT4 dialog boxes). The default size of 0 means that the MFC code will determine the correct dialog box size to use based on the operating system version on which the program is run.
[in]
bVistaStyle
Note This parameter is applicable only if you are compiling in Windows Vista.
The parameter that specifies the style of the file dialog. Set it to TRUE to use the new Vista style file dialogs. Otherwise, the old style of dialog boxes will be used. See the Remarks section for more information about compiling under Vista.
Remarks
Either a File Open or File Save As dialog box is constructed, depending on the value ofbOpenFileDialog.
To enable the user to select multiple files, set the OFN_ALLOWMULTISELECT flag before you callDoModal.
You must supply your own file name buffer to store the returned list of multiple file names. Do this by replacing
m_ofn.lpstrFile with a pointer to a buffer you have allocated, after you construct theCFileDialog, but before you call
DoModal. Additionally, you must set m_ofn.nMaxFile with the number of characters in the buffer pointed to by
m_ofn.lpstrFile. If you set the maximum number of files to be selected ton, the necessary buffer size isn*