BExplorer.Shell._Plugin_Interfaces.FileSystemListItem.GetSystemImageListIndex C# (CSharp) Method

GetSystemImageListIndex() public method

public GetSystemImageListIndex ( IntPtr pidl, ShellIconType type, ShellIconFlags flags ) : int
pidl System.IntPtr
type ShellIconType
flags ShellIconFlags
return int
    public int GetSystemImageListIndex(IntPtr pidl, ShellIconType type, ShellIconFlags flags) {
      var info = new SHFILEINFO();
      IntPtr result = Shell32.SHGetFileInfo(pidl, 0, out info, Marshal.SizeOf(info),
                          SHGFI.Icon | SHGFI.SysIconIndex | SHGFI.OverlayIndex | SHGFI.PIDL | (SHGFI)type | (SHGFI)flags);

      if (result == IntPtr.Zero) {
        throw new Exception("Error retrieving shell folder icon");
      }

      User32.DestroyIcon(info.hIcon);
      return info.iIcon;
    }