64,636
社区成员
发帖
与我相关
我的任务
分享
CFileDialog openFileDlg(TRUE,NULL,NULL,OFN_ALLOWMULTISELECT, _T( "所有文件 (*.*)|*.*||" ),AfxGetMainWnd());
const int nMaxFiles = 1000;
CHAR* nMaxPathBuffer = new CHAR[ nMaxFiles*MAX_PATH ] ;
openFileDlg.m_ofn.lpstrFile = nMaxPathBuffer;
openFileDlg.m_ofn.lpstrFile[0] = NULL;
openFileDlg.m_ofn.nMaxFile= nMaxFiles*MAX_PATH;
// 点击确定按钮
if(openFileDlg.DoModal()== IDOK)
{
if ( nMaxPathBuffer )
{
//选择多个文件时获得其文件名
POSITION posStart=openFileDlg.GetStartPosition();
while ( posStart )
{
// 路径名在这里依次获得
CString filePathName = openFileDlg.GetNextPathName(posStart);
}
}
}