Example #1
0
        public const uint SHGFI_SMALLICON = 0x1; // 'Small icon

        #endregion Fields

        #region Methods

        public static System.Drawing.Icon getIcon(string fullPath)
        {
            SHFILEINFO shInfo = new SHFILEINFO();
            Win32.SHGetFileInfo(fullPath, 0, ref shInfo, (uint)Marshal.SizeOf(shInfo), Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON);
            if (shInfo.hIcon != (IntPtr)0)
            {
                return Icon.FromHandle(shInfo.hIcon);
            }
            return null;
        }
Example #2
0
 public static extern IntPtr SHGetFileInfo(string pszPath,
     uint dwFileAttributes,
     ref SHFILEINFO psfi,
     uint cbSizeFileInfo,
     uint uFlags);
Example #3
0
 public static extern IntPtr SHGetFileInfo(string pszPath,
                                           uint dwFileAttributes,
                                           ref SHFILEINFO psfi,
                                           uint cbSizeFileInfo,
                                           uint uFlags);