代码
CString CWhiteInputTool_VCDlg::SelectDir()
{
    BROWSEINFO bi;
    TCHAR szPathName[MAX_PATH];
    TCHAR szTitle[] 
= _T("选择路径");
    ZeroMemory(
&bi, sizeof(BROWSEINFO));

    bi.hwndOwner 
= GetSafeHwnd();
    bi.pszDisplayName 
= szPathName;
    bi.lpszTitle 
= szTitle;
    bi.ulFlags 
= 0x0040 ; 
    CString str;
    CString strDir;  
//选择的目录

    LPITEMIDLIST idl 
= SHBrowseForFolder(&bi);
    
if(idl == NULL)
    {
        strDir
= _T("");
        
return strDir;
    }

    SHGetPathFromIDList(idl, str.GetBuffer(MAX_PATH 
* 2));
    str.ReleaseBuffer();
    
if(str != _T(""&& str.GetAt(str.GetLength() - 1!= _T('\\'))
        str 
+= _T("\\");
    
    strDir 
= str;

    
return strDir;
}

 

 

相关文章:

  • 2021-10-25
  • 2022-12-23
  • 2021-09-03
  • 2021-05-25
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2021-09-01
  • 2022-12-23
相关资源
相似解决方案