Given an IShellFolder, is there a way to determine if it represents a hard disk drive, a floppy drive, a CD drive, a network share, a USB drive, et cetera? The only vaguely similar thing I've found so far is the SFGAO_REMOVABLE flag of IShellFolder::GetAttributesOf (obviously I would have to do that relative to the folder's parent). But that's not very detailed, and also the docs seem to indicate that anything on removable media would have this set (as opposed to just the drive's root). Thanks in advance for any help.
If I rember correctly this can be done by getting the root letter of the path. Win32 has an API called GetDriveType that will return the type of the drive (see docs how to use it). There are also some helper functions in win32 that make it easy to get root letter from a full path.
[Reposted due to buggy MS news servers dropping messages] nifbuptuck@gmail.com wrote: > Given an IShellFolder, is there a way to determine if it represents a > hard disk drive, a floppy drive, a CD drive, a network share, a USB > drive, et cetera? > > The only vaguely similar thing I've found so far is the > SFGAO_REMOVABLE flag of IShellFolder::GetAttributesOf (obviously I > would have to do that relative to the folder's parent). But that's > not very detailed, and also the docs seem to indicate that anything on > removable media would have this set (as opposed to just the drive's > root). You could try SHGetDataFromIDList with the SHGDFIL_DESCRIPTIONID format. -- Jim Barry, Microsoft MVP