CFileDialog 默认文件夹/文件类型过滤

CFileDialog dlg(true);
 dlg.m_ofn.lpstrInitialDir = "f:\新建文件夹";

CFileDialog dlg(true,NULL,NULL,OFN_HIDEREADONLY|
OFN_OVERWRITEPROMPT,"文本文件(*.txt)|*.txt||");
dlg.m_ofn.lpstrInitialDir = "f:\";

CFileDialog dlg(true,NULL, NULL,  OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT);

  if(IDOK == dlg.DoModal())
  {

  for(POSITION  pos = dlg.GetStartPosition() ; NULL != pos ; )

  {

   CString strFileName = dlg.GetNextPathName(pos);
         AfxMessageBox(strFileName);
  }
  }

 if(IDOK == dlg.DoModal())
 {
  //...
 }

 

posted @ 2016-02-25 16:23  風行  阅读(483)  评论(0编辑  收藏  举报