// Display Folder dialog, return the path of the selected Fountain clip CSTRING BROWSEFORFOLDER (hwnd hwnd) {tchar sztitle [] = _t ("select a folder"); tchar szdisplayname [MAX_PATH] = _t ("); tchar szpath [ MAX_PATH] = _t (""); browseinfo bi;
Bi.hwndowner = hwnd; bi.pidlroot = null; bi.lpsztitle = sztitle; bi.pszdisplayName = szdisplayName; bi.ulflags = bif_returnonlyfsdirs; bi.lpfn = null; bi.lparam = 0;
LPITEMIDLIST pItemIDList = SHBrowseForFolder (& bi); if (pItemIDList) {SHGetPathFromIDList (pItemIDList, szPath); IMalloc * pMalloc; if (! SHGetMalloc (& pMalloc) = NOERROR) {TRACE ( "Failed to get pointer to shells task allocator"); return Szpath;} pmalloc-> free (pithmidlist); if (pmalloc) pmalloc-> release ();} return szpath;