i found the following code to allow me to browse for a folder
CFileDialog od(TRUE/*bOpenFileDialog*/, NULL, NULL, OFN_HIDEREADONLY |
OFN_OVERWRITEPROMPT , NULL, NULL, 0, TRUE/*bVistaStyle*/);
IFileOpenDialog * openDlgPtr = od.GetIFileOpenDialog();
if ( openDlgPtr != NULL )
{
openDlgPtr->SetOptions(FOS_PICKFOLDERS);
openDlgPtr->Release();
}
int r = od.DoModal();
it opens a file dialog ok and i can select a folder and the Open button becomes enabled, but pressing it just opens the folder, it doesn't select it. DoModal doesn't return unless i hit Cancel
any ideas how i can select a folder in MFC? thanks
by the way, i know about CFolderDialog http://www.codeproject.com/Articles/2024/CFolderDialog-Selecting-Folders?msg=4497794#xx4497794xx
nice project but when i select my USB mounted android folder the dialog returns not OK so its no use to me unless i can fix it
UPDATE
i also found this
BROWSEINFO bi = { 0 };
TCHAR path[MAX_PATH];
bi.lpszTitle = _T("Pick a Directory");
bi.pszDisplayName = path;
LPITEMIDLIST pidl = SHBrowseForFolder ( &bi );
if ( pidl != 0 )
{
// get the name of the folder
//_tprintf ( _T("Selected Item: %s\n"), path );
// free memory used
IMalloc * imalloc = 0;
if ( SUCCEEDED( SHGetMalloc ( &imalloc )) )
{
imalloc->Free ( pidl );
imalloc->Release ( );
}
setMobilePath(path);
}
which does allow me to select a folder on my android device but it doesn't return the full path, just the folder name which isn't much use either