char szDir[MAX_PATH]; BROWSEINFO bi; ITEMIDLIST *pidl; 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; if(!SHGetPathFromIDList(pidl, szDir)) return; AfxMessageBox(szDir); //szDir中存放的内容为用户选定的目录