Azure/C++/C#/Java/Asp.net/JavaScript/Html - MFC/COM/ActiveX/eclipse/Web
Code
CString CXXXDlg::ShowSelectDirectoryDlg(const CString & strDlgTitle)
{
static TCHAR szDir[MAX_PATH];
ZeroMemory(szDir, MAX_PATH*sizeof(TCHAR)):
BROWSEINFO bi;
ZeroMemory(&bi, sizeof(BROWSEINFO)):
ITEMIDLIST *pidl = NULL;
bi.hwndOwner = this->m_hWnd;
bi.pidlRoot = NULL;
bi.pszDisplayName = szDir;
bi.lpszTitle = strDlgTitle;
bi.ulFlags = BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
bi.iImage = 0;
pidl = SHBrowseForFolder(&bi);
if(pidl == NULL) return _T("");
if(!SHGetPathFromIDList(pidl, szDir)) return _T("");
return CString(szDir);
}
// testing code
CString strFolderPath = CXXXDlg::ShowSelectDirectoryDlg(_T("选择源码目录"));
Software