Getting the PIDL of a IShellFolder - Programmers Heaven

Howdy, Stranger!

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

Categories

Getting the PIDL of a IShellFolder

Hi!

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