Share via


Getting a Path from an IDList

Not much to this - but I notice searches for this coming to my blog, so I might as well provide the answer.

 

Use SHGetPathFromIDList - as long as the pidl is part of the file system, this will succeed.  If you don't need a file system path, you can pass something like PKEY_ItemFolderPathDisplay to IShellItem2::GetProperty (use SHCreateItemFromIDList to go from a pidl to an IShellItem2).

 

Incidently, if you want to surface search results in Windows Vista, make sure your IShellFolder also supplies PKEY_ItemFolderPathDisplayNarrow or you'll end up looking silly (if there's a difference between your parsing path and your display path).

 

Enjoy,

James