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()) { //... }