Recently I was asked how to extract the full path from an item on the desktop. I had written a demo that would get the display name and position for someone here and have expanded it to include translating the PIDL that is stored in the item lParam to a fully qualified path. Since the IDL that the PIDL is pointing to is resident in the desktop process, it must first be copied to our process then we can use standard SH* functions that accept a PIDL. Here is the project that demos how to do it if anyone is interested, it is fully compatible with all Windows versions I have tested on (NT4, Win95OSR0, Win98SE and Win2K). Though this will work on all Windows versions, it looks best with Common Controls V4.71 or better.

The original demo was only NT compatible, which presented a few problems (and comments) that I have fixed up in this version. For Win9x it uses a few undocumented API functions for interprocess memory allocation (ordinal imports), but since those OS versions will no longer be updated this should not present any problems. The NT execution path only uses documented functions to insure future compatibility:

I have moved the file to my website
Posted on 2004-07-09 12:19:19 by donkey
fun :)
Posted on 2004-07-09 23:49:23 by Homer