CFileDialog dlg(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT, _T("Todos los archivos (*.*)|*.*||"), NULL);
CStringList fileList;
if (dlg.DoModal() == IDOK)
{
POSITION pos = dlg.GetStartPosition();
CString filePath;
CString folderPath = dlg.GetFolderPath();
while (pos != NULL)
{
filePath = dlg.GetNextPathName(pos);
fileList.AddTail(filePath);
}
// Aquí puedes hacer lo que necesites con la lista de archivos y el directorio
// Por ejemplo, puedes recorrer la lista y mostrar los nombres de los archivos
POSITION filePos = fileList.GetHeadPosition();
while (filePos != NULL)
{
CString fileName = fileList.GetNext(filePos);
// Hacer algo con el nombre del archivo
}
}