I know how to get all open explorer windows, using Microsoft Internet Controls COM library. From this, I am able to find the LocationURL
of those windows. However, this is only set for paths on the file system. Seemingly when virtual objects are displayed, like network printers or the recycle bin, LocationURL
is empty. LocationName
still seems to be set to the name which is visible on the start bar.
When LocationURL
is set, this is sufficient for my purposes to know where the explorer window is pointing to, but how can I find out what it is pointing to for these special folders?
Reading up a bit on pointers to an item identifier list (PIDL). Knowing which PIDL is being shown in the explorer window could identify that. Is there any way to retrieve this?
Here is a sample C# Console app code that gets the PIDL of current Windows explorer windows:
Note: Shell interfaces are only partially defined as we don't need the full details. Feel free to complete it if you need other information.