--
Nothing impossible, Nothing sure
when the 2nd para is SHGDN_INFOLDER, I get the name "My computer", when the
2nd para is SHGDN_FORPARSING, I get the path is a series of digits instead of
real path, the series of digits is just like GUID for COM.
In above code, StrRetToString is coded like below:
void CLPDlg::StrRetToString(STRRET s, CString &sout)
{
if (s.uType == STRRET_WSTR) {
int nSz = WideCharToMultiByte (CP_OEMCP, NULL, s.pOleStr, -1,
NULL, 0, NULL, NULL);
char* pS = sout.GetBuffer(nSz+1);
WideCharToMultiByte (CP_OEMCP, NULL, s.pOleStr, -1,
pS, nSz, NULL, NULL);
sout.ReleaseBuffer();
sout = pS;
m_pMalloc->Free(s.pOleStr);
}
}
Your help would be greatly appreciated.
--
"My Computer" is a virtual folder, not a filesystem folder. You can't get a path for it because it simply doesn't have one. For virtual folders, the shell uses a parsing name that includes the CLSID, as you have seen. This is explained in the documentation for GetDisplayNameOf and ParseDisplayName.
--
Jim Barry, MVP (Windows SDK)