I have an app that needs to run on XP, but I want to be able to call ::SHCreateItemFromParsingName() which is only available from Vista onwards.
Said:
I believe you could achieve the same effect as follows: SHParseDisplayName to obtain item PIDL, then SHGetDesktopFolder, and finally IShellFolder::BindToObject
Which I've attempted:
IFileDialog *pfd;
....
PIDLIST_ABSOLUTE pidl;
HRESULT hresult = ::SHParseDisplayName(m_path, 0, &pidl, SFGAO_FOLDER, 0);
if (SUCCEEDED(hresult))
{
IShellFolder *psf;
hresult = ::SHGetDesktopFolder(&psf);
if (SUCCEEDED(hresult))
{
IShellItem *child;
hresult = psf->BindToObject(pidl, 0, IID_IShellFolder, (void**)&child);
if (SUCCEEDED(hresult))
{
pfd->SetFolder(child);
}
}
}
I think I'm mainly struggling with the BindToObject (as I'm not a particularly skilled windows programmer!)
Is this even vaguely right?
SHParseDisplayName
thenSHCreateShellItem
.