CFolderPickerDialog does not return selected path!

  • Thread starter Thread starter Juan Dent
  • Start date Start date
J

Juan Dent

Guest
The following code does not behave as expected:


CString folder_picker_title = L"Escoger directorio base para busquedas";

CString initial_path;
m_base_folder.GetWindowTextW(initial_path);

CFolderPickerDialog folder_picker{initial_path};
folder_picker.m_ofn.lpstrTitle = folder_picker_title;
auto ret = folder_picker.DoModal();
if (ret == 1)
{
auto str = folder_picker.GetFolderPath();
// does not return selected folder
}



The folder picker dialog is displayed and allows one to navigate the directories. Upon selecting a directory and hitting the "Select Folder" button, it ends its modal loop but GetFolderPath() does NOT return the selected folder, instead it returns a portion of the path (say the selected folder was "C:\Users\Juan Dent\Documents", it might return "C:\Users".



Another application with identical code works fine. I thought maybe there was a mixture of different SDKs but I checked and its dependencies all have the same SDKs.


Any ideas?

This is driving me nuts!!



Thanks,

Juan


Juan Dent

Continue reading...
 
Back
Top