CFileDialog fileDlg(TRUE,NULL,NULL,0,"cpp文件(*.cpp)|*.cpp|txt文件(*.txt)|*.txt||");
CFileDialog dlg(TRUE);///TRUE为OPEN对话框,FALSE为SAVE AS对话框 if(dlg.DoModal()==IDOK) FilePathName=dlg.GetPathName(); } 相关信息:CFileDialog 用于取文件名的几个成员函数: 假如选择的文件是C:WINDOWSTEST.EXE 则: (1)GetPathName();取文件名全称,包括完整路径。取回C:\WINDOWS\TEST.EXE (2)GetF...
函数原型如下: CFileDialogopenFileDlg(BOOL bOpenFileDialog, LPCTSTR lpszDefExt =NULL,LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT , LPCTSTR lpszFilter = NULL , CWnd *pParentWnd = NULL); 用法案例: CFileDialog dlg(true, NULL, NULL, OFN_FILEMUSTEXIST | ...
CFileDialog fileDlg(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT, _T("文本文件(*.txt),*.txt,所有文件(*.*),*.*"), this); ``` 2.显示文件对话框。 可以使用CFileDialog类的DoModal(函数显示文件对话框,并返回对话框的结果值。 ```cpp INT_PTR DoModal(; ``` 上面的函数将文件对话框显示为模态对话...
程序就自动关闭是因为出错崩溃了,所以被操作系统自动关闭。出错的语句是这句 fileDlg.m_ofn.lpstrFileTitle=_T("保存文件");因为m_ofn.lpstrFileTitle这个成员是用来接收输入的文件名的(MSDN上的说明是:Pointer to a buffer that receives the file name and extension (without path information) of ...
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 lpszFileNam...
CFileDialog fileDlg(true, "cfg", "*.cfg", OFN_FILEMUSTEXIST| OFN_HIDEREADONLY,配置文件(*.cfg)|*.cfg||", this); CFileDialog构造函数原型为: CFileDialog::CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, ...
CFileDialog openFileDlg(BOOL bOpenFileDialog, LPCTSTR lpszDefExt =NULL,LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT , LPCTSTR lpszFilter = NULL , CWnd *pParentWnd = NULL); 用法案例: CFileDialog dlg(true, NULL, NULL, OFN_FILEMUSTEXIST | OFN_PATHMUST...
就像QT里面的show函数一样,虽然CFileDialog dlg在内存中创造了一个对话框对象,但是显示出来给人看,还需要专门的函数DoModal()。 “Call this function to display the Windows common file dialog box and allow the user to browse files and directories and enter a filename.”调用此函数可显示Windows公用文件对...