BROWSEINFO bi; ZeroMemory(&bi, sizeof(bi)); TCHAR szDisplayName[MAX_PATH]; szDisplayName[0] = 'a'; bi.hwndOwner = NULL; bi.pidlRoot = NULL; bi.pszDisplayName = szDisplayName; bi.lpszTitle = _T("Please select a folder to locate your PGA :"); bi.ulFlags = BIF_RETURNONLYFSDIRS; bi.lParam = NULL; bi.iImage = 0; LPITEMIDLIST pidl = SHBrowseForFolder(&bi); TCHAR szPathName[MAX_PATH]; if (NULL != pidl) { BOOL bRet = SHGetPathFromIDList(pidl,szPathName); if(FALSE == bRet) { return; } else { PGA_PATH.Clear(); PGA_PATH.SetWindowTextA(szPathName); //PGA_PATH name of the text box SetValudata(szPathName); //SetValudata saves the path selected by the user in a file . } }
Path string---> C:\PGA or C:\Users\mm232\Pictures\PGA C:\Users\mm232\PGA\Pictures
SHBrowseForFolder
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)