Here is code that will take a CFileDialog object and read in multiple file selections into a CArray<CString,CString&>.
The array fileNameList will contain the filenames and extensions and the array pathList contains all of the full paths.
In the OPENFILENAME structure the lpstrFileName and lpstrFileTitle fields are only for single select Dialogs.
CArray<CString,CString&> fileNameList;
CArray<CString,CString&> pathList;
CArray<CString,CString&> fileList;
CFileDialog fDlg(TRUE); //open dialog
CString ext;
int lcv;
if(fileDlg.DoModal()==IDOK
int place=0;
int size=0;
int len;
LPTSTR string=fDlg.m_ofn.lpstrFil
while(string[place]!='\0')
fileList.SetSize(size+1);
while(string[place]!='\0')
fileList[size]+=string[pla
++place;
}
++place;
++size;
}
len=fileList.GetSize();
if(len>1){
for(lcv=1;lcv<len;++lcv){
ext=fileList[lcv].Right(3)
ext.MakeUpper();
if(ext!="EST" && ext!="MAS"){
fileList.RemoveAt(lcv);
--lcv;
--len;
}
}
len=fileList.GetSize();
if(len<=1) return;
if(fileList[0][fileList[0]
fileList[0]+='\\';
}
for(lcv=1;lcv<len;++lcv){
fileNameList.Add(fileList[
pathList.Add(fileList[0]+f
}
}
else{
ext=fileDlg.GetFileExt();
ext.MakeUpper();
if(ext=="MAS" || ext=="EST"){
fileNameList.Add(fileDlg.G
pathList.Add(fileDlg.GetPa
}
}
}
Main Topics
Browse All Topics





by: jhancePosted on 2001-08-21 at 08:14:41ID: 6410260
Can you show your code?