文件框设置

来源:互联网 发布:厦门市金马甲网络 编辑:程序博客网 时间:2024/06/01 15:43
CFileDialog类封装了Windows常用的文件对话框。常用的文件对话框提供了一种简单的与Windows标准相一致的文件打开和文件存盘对话框功能。

CFileDialog fileDlg(FALSE); //构造对话框对象(FALSE)表示保存(TRUE)表示打开

MSDN里有说明,要以 两个 '|' 结尾,你在最后加上两个 ‘|’ 就好了,如下:

CFileDialog fileDlg(TRUE,NULL,NULL,0,"cpp文件(*.cpp)|*.cpp|txt文件(*.txt)|*.txt||");

// CFileDialog fileDlg(FALSE,"xls","*.xls", OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT,"导出文件(*.xls)|*.xls|");

 

CString filename;
 CString fileControl = "           ";
 CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
 CControlInfo *pControlInfo = CControlInfo::GetSingletonPtr();

 CTime time = CTime::GetCurrentTime();
 CString sTime;
 sTime.Format("%d-%d-%d  %d:%d:%d", time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());
 CString sNameTime;
    sNameTime.Format("//Bin//DataFile//%d-%d-%d  %d.%d.%d.csv", time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());

 filename = pControlInfo->GetSysCurPath() + sNameTime;
  CFile  file(filename, CFile::modeCreate | CFile::modeWrite);

 

原创粉丝点击