SHGetFileInfo question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how do i get the My Computer icon using SHGetFileInfo?
i've tried this:

SHGetFileInfo("", FILE_ATTRIBUTE_NORMAL, shinfo, Marshal.SizeOf(shinfo),
SHGFI_ICON + SHGFI_SMALLICON + SHGFI_DISPLAYNAME)

but it doesn't work.
i'm not sure what the filename for My Computer should be?
 
You will have to first get the PIDL of My Computer using
SHGetSpecialFolderLocation and then pass this PIDL as the 1st parameter of
the SHGetFileInfo function.

---------
- G Himangi, Sky Software http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
 
i tried it with a PIDL:

Dim tmpPidl As IntPtr

SHGetSpecialFolderLocation(0, CSIDL_DRIVES, tmpPidl)
SHGetFileInfo(tmpPidl, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_PIDL +
SHGFI_DISPLAYNAME + SHGFI_ICON + SHGFI_SMALLICON)

Marshal.FreeCoTaskMem(tmpPidl)

it gets the PIDL ok, but the SHGetFileInfo causes an error
 
found it. thanks
it was a badly declared API

.paul. said:
i tried it with a PIDL:

Dim tmpPidl As IntPtr

SHGetSpecialFolderLocation(0, CSIDL_DRIVES, tmpPidl)
SHGetFileInfo(tmpPidl, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_PIDL +
SHGFI_DISPLAYNAME + SHGFI_ICON + SHGFI_SMALLICON)

Marshal.FreeCoTaskMem(tmpPidl)

it gets the PIDL ok, but the SHGetFileInfo causes an error
 
Back
Top