[Win32utils-devel] Getting virtual folder information
phasis at gmail.com
Fri Sep 26 00:59:04 EDT 2008
2008/9/26 Berger, Daniel <Daniel.Berger at qwest.com>:
> One of the problems with SHGetFolderPath is that it doesn't work for
> virtual folders. I _think_ we can get it with SHGetFolderLocation, but
> I'm not positive, as I'm having a bit of trouble making it work.
> Any ideas on how to get, say, the value of CSIDL_DRIVES? I mean, it
> should be "My Computer", but I want to get it programmatically.
pidl = 0.chr * 4
SHGetSpecialFolderLocation(0, CSIDL_DRIVES, pidl)
# size of SHFILEINFO is 692 bytes
info = 0.chr * 692
# 0x200 says get display name, 0x8 says PIDL, not path.
SHGetFileInfo(pidl.unpack('L').first,0, info ,692,0x208)
folder = info[12..-1].strip
More information about the win32utils-devel