Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Getting the PIDL of a IShellFolder
My endeavor is when launching my application, to select the last accessed folder of TreeView structure that was populated by the lpsfDesktop->EnumObjects(lpsfDesktop). When the tree is first initialized, it contains only My Computer, My Document, Network, and Recycle Bin. I'm basing my implementation on (Barretto VN 7/2002) project on koders.com.
So what I tried to do is use ParseDisplayName() on the folder I want to navigate too in order to retrieve the PIDL. Then use SHBindToParent() function to get the parent's LPSHELLFOLDER pointer. But then I cannot get that folder PIDL to repeat the steps until reaching root. For example:
[code]// szOleChar contains "C:\Documents and Settings\Eucloid\My Documents\";
hr = lpsfDeskTop->lpVtbl->ParseDisplayName(lpsfDeskTop, NULL, NULL, szOleChar, &chEaten, &pidl, &dwAttributes);
// convert PIDL to LPSHELLFOLDER
LPSHELLFOLDER psfFolder = NULL;
hr = SHBindToParentLocal(pidl, &IID_IShellFolder, &psfFolder, &pidlLast);
// [b]Then how do I get the psfFolder's pidl? With the pidl, I could bind again to the Parent folder.[/b][/code]
(ii) Is this the right way to do that? I also don't know how to match the "My Document" to "C:\Documents and Settings\Eucloid\My Documents\"; I tried IShellFolder->CompareIDs(), and ILIsParent() without success. I really don't know why ILIsParent doesn't work. That would have been a solution to what I want to do.
Thanks. And I'll post the answer if I ever find it.
0 · ·