Hi, I had the same problem, it seemed to me that the easiest way was using SHBrowseForFolder() API function. Here I made a more simple function that wraps the API and gives you what you want:
void CParserDlg::BrowseForFolder(char *szTitle, HWND hwndOwner, char *szResult){
BROWSEINFO bi;
memset((LPVOID)&bi, 0, sizeof(bi));
TCHAR szDisplayName[_MAX_PATH+1];
szDisplayName[0] = '\0';
bi.hwndOwner = hwndOwner;
bi.pidlRoot = NULL;
bi.pszDisplayName = szDisplayName;
bi.lpszTitle = szTitle;
bi.ulFlags = BIF_RETURNONLYFSDIRS;
LPITEMIDLIST pIIL = ::SHBrowseForFolder(&bi);
BOOL bRet = ::SHGetPathFromIDList(pIIL, szResult);
if (!bRet)
{
*szResult='\0';
}
LPMALLOC pMalloc;
/*HRESULT hr = */SHGetMalloc(&pMalloc);
pMalloc->Free(pIIL);
pMalloc->Release();
}
And here is an example of how to call it:
BrowseForFolder(_T("Choose the output folder:"

,
GetSafeHwnd(), szOutputDir); (you get the full path into the third parameter, note that it must be already allocated.