CString Cusb_testDlg::SelectPath()
{
// TODO: 在此添加控件通知处理程序代码
CString str;
TCHAR pszPath[MAX_PATH];
BROWSEINFO bi;
bi.hwndOwner = this->GetSafeHwnd();
bi.pidlRoot = NULL;
bi.pszDisplayName = NULL;
bi.lpszTitle = _T("请选择文件夹");
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
bi.lpfn = NULL;
bi.lParam = 0;
bi.iImage = 0;
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
if (pidl == NULL)
{
return FALSE;
}
if (SHGetPathFromIDList(pidl, pszPath))
{
str = pszPath;
UpdateData(FALSE);
}
return str; //返回用户选择路径
}