转载地址 点击打开链接 http://blog.csdn.net/good_jianhong/article/details/6749483
size_t index;
CString cstrsucstring;
CFileDialog filedlg(TRUE,NULL,NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |OFN_ALLOWMULTISELECT,_T("Source Files(*.cpp;*.c;*.cc;*.cxx)|*.cpp;*.c;*.cc;*.cxx|Head Files(*.h;*.hpp;*.hxx)|*.h;*.hpp;*.hxx||"));
TCHAR *pBuffer = new TCHAR[MAX_PATH * 20];//最多允许同时打开20个文件
filedlg.m_ofn.lpstrFile = pBuffer;
filedlg.m_ofn.nMaxFile = MAX_PATH * 20;
filedlg.m_ofn.lpstrFile[0] = '\0';
if (filedlg.DoModal() == IDOK)
{
CString cstrfilepath = _T("");
POSITION pos = filedlg.GetStartPosition();
while (pos != NULL)
{
cstrfilepath = filedlg.GetNextPathName(pos);//取得文件路径
}
}