Welcome: Hunan Intelligent Applications Tecgnology CO.,ltd.-HNIAT.com
Language: Chinese ∷  English

Basic knowledge

CFileDialog usage

CFileDialog function prototype in MSDN

CFileDialog :: CFileDialog (
BOOL bOpenFileDialog,
LPCTSTR lpszDefExt = NULL,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
LPCTSTR lpszFilter = NULL,
CWnd * pParentWnd = NULL)

Parameter explanation:

bOpenFileDialog: TRUE is the open file dialog; FALSE is the save file dialog


lpszDefExt: the default extension


lpszFileName: The file name of the edit box displayed in the file name combo box by default. Generally, NULL is optional.


dwFlags: dialog style, generally OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, that is, hide the read-only option and prompt before overwriting existing files.


Types of:


OFN_HIDEREADONLY: Hide read-only options


OFN_OVERWRITEPROMPT: Overwrite existing files


OFN_ALLOWMULTISELECT: Allow selection of multiple files


OFN_CREATEPROMPT: If the entered file name does not exist, the dialog box returns a message box asking the user whether to create a file based on the secondary file name


OFN_FILEMUSTEXIST: Only existing file names can be entered


OFN_FORCESHOWHIDDEN: can show hidden files


OFN_NOREADONLYRETURN: Do not return read-only files


OFN_OVERWRITEPROMPT: When the saved file already exists, display the information that the file exists


lpszFilter: File filter type, which indicates the file types to choose from and the corresponding extensions. The parameter format is:
"Chart Files (* .xlc) | * .xlc | Worksheet Files (* .xls) | * .xls | Data Files (* .xlc; *. Xls) | * .xlc; * .xls | All Files (*. *) | *. * || "; file type descriptions and extensions are separated by |, and file extensions of the same type can be separated by |; each file type is separated by |, and the end is indicated by ||.


pParentWnd: the parent window pointer, generally optional NULL.

-------------------------------------------------- -------------------------------------------------- ---

Example:

CFileDialog dlg (TRUE, "avi", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "(*. Avi; *. Mp4; *. Wmv) | * .avi; *. Mp4; *. Wmv ||");
if (dlg.DoModal () == IDOK)
{
m_video = dlg.GetPathName ();
}

CONTACT US

Contact: Manager Xu

Phone: 13907330718

Tel: 0731-22222718

Email: hniatcom@163.com

Add: Room 603, 6th Floor, Shifting Room, No. 2, Orbit Zhigu, No. 79 Liancheng Road, Shifeng District, Zhuzhou City, Hunan Province

Scan the qr codeClose
the qr code