CString tempName,tempPath,m_ofilepath;
char m_ofilenames[3000][MAX_PATH];
CFileDialog ofiledlg(TRUE,NULL,NULL,OFN_ALLOWMULTISELECT,"o文件(*.*o)|*.*o||");
DWORD MAXFILE = MAX_PATH*_MAX_FNAME; //定义最大内存
char* buffer = new char[MAXFILE];
ZeroMemory(buffer,sizeof(MAXFILE));
ofiledlg.m_ofn.nMaxFile = MAXFILE;
ofiledlg.m_ofn.lpstrFile = buffer;
int iReturn = ofiledlg.DoModal();
if (iReturn == IDOK)
{
int nCount = 0;
m_ofilepath = ofiledlg.GetPathName();
POSITION pos = ofiledlg.GetStartPosition();
while(pos != NULL)
{
tempPath = ofiledlg.GetNextPathName(pos);
tempName = tempPath.Mid(tempPath.ReverseFind('\\')+1);
strcpy(m_ofilenames[nCount],tempName);
nCount++;
}
}
else if (iReturn == IDCANCEL)
{
}
delete []buffer;