CString m_strPath = L""; TCHAR szDir[MAX_PATH]; BROWSEINFO bi; ITEMIDLIST *pidl; bi.hwndOwner = this->m_hWnd; bi.pidlRoot = NULL; bi.pszDisplayName = szDir; bi.lpszTitle = L"请选择目录"; bi.ulFlags = BIF_STATUSTEXT | BIF_USENEWUI | BIF_RETURNONLYFSDIRS; bi.lpfn = NULL; bi.lParam = 0; bi.iImage = 0; pidl = SHBrowseForFolder(&bi); if(pidl == NULL) return; if(!SHGetPathFromIDList(pidl, szDir)) return; else m_strPath = szDir; AfxMessageBox(m_strPath); m_EditPath.SetWindowTextW(m_strPath);