
CString CPublicFuncs::GetFilePath(CString title)



{
CString strFilePath;
TCHAR pszBuffer[_MAX_PATH];
BROWSEINFO bi; LPITEMIDLIST pidl;
bi.hwndOwner = NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = title;
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
if((pidl = SHBrowseForFolder(&bi)) != NULL) 
{
if(SHGetPathFromIDList(pidl, pszBuffer)) 
{
CString strTemp(pszBuffer); strFilePath = strTemp;
if (strFilePath.GetLength() <= 1) 
{
}
else if (strFilePath.Right(1) != _T(“\\“))
strFilePath += _T(“\\“);
}
}
return strFilePath;
}
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/111098.html原文链接:https://javaforall.net
