I want to launch a dialog box in MFC, select multiple files and show this file to the user and later copy this file to another location.
I have written this code to try and achieve this:
CFileDialog fOpenDlg(TRUE,"", " ", OFN_ALLOWMULTISELECT|OFN_FILEMUSTEXIST,
"Capture file (*.cap)|*.cap|", this);
fOpenDlg.m_pOFN->lpstrTitle="Import file";
fOpenDlg.m_pOFN->lpstrInitialDir="Desktop";
if(fOpenDlg.DoModal()==IDOK)
{
POSITION pos=fOpenDlg.GetStartPosition();
while(pos)
{
CString PathName=fOpenDlg.GetNextPathName(pos);
CString strFileName=fOpenDlg.GetFilename();
AfxMessageBox(strFileName);
}
}
The problem with this is that when I select single file it gives file name but when I select multiple files it does not give any file name ?
I do not know the reason why?