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

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);
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.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!