Berger, Daniel
2008-Sep-25 22:03 UTC
[Win32utils-devel] Getting virtual folder information
Hi, 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. Thanks, Dan PS - I''ve added SHGetFolderLocation to Windows::Shell in CVS. This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
Hi, 2008/9/26 Berger, Daniel <Daniel.Berger at qwest.com>:> Hi, > > 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. >require ''windows/shell'' include Windows::Shell 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 Regards, Park Heesob
Heesob Park wrote:> Hi, > > 2008/9/26 Berger, Daniel <Daniel.Berger at qwest.com>: >> Hi, >> >> 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. >> > require ''windows/shell'' > include Windows::Shell > > 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].stripExcellent, thanks! Dan