Search code examples
c++windowsshell-extensions

How to differentiate Whether a Drive or NetWork Drive, on RightClick


When I Rightclick on a Shell Drive I want to differentiate whether the Drive is a Normal Drive or a Network Drive.

I hope we can do this using Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY) method but unsure which parameter to use.


Solution

  • Initialize is now documented to take a PCIDLIST_ABSOLUTE (not LPCITEMIDLIST), so you know it's rooted in My Desktop. My Computer is the second ItemID on that list, and the drive is the third ItemID. As Luke indicated, once you have the drive, GetDriveType will tell you whether the drive is remote.