SHBrowseForFolder(选择文件夹)

 void CFileSearchImage::OnButtonBrower()
{
 // TODO: Add your control notification handler code here
 BROWSEINFO bi;
 char dispName[MAX_PATH],path[MAX_PATH];
 CString str_title = _T("搜索图片");
 ITEMIDLIST *pidl;
 
 bi.hwndOwner = m_hWnd;
 bi.pidlRoot = 0;
 bi.pszDisplayName = dispName;
 bi.lpszTitle = str_title;
 bi.ulFlags = BIF_RETURNONLYFSDIRS|BIF_EDITBOX|BIF_DONTGOBELOWDOMAIN;
 bi.lpfn = NULL;
 bi.lParam = 0;
 bi.iImage = 0;

 if(pidl=SHBrowseForFolder(&bi))
 {
  //MessageBox("您选择了确定按钮!");
  SHGetPathFromIDList(pidl,path);
  m_strImageDir = CString(path);  
  UpdateData(false);
 }
}

你可能感兴趣的:(SHBrowseForFolder(选择文件夹))