public static System.Drawing.Icon GetSystemIcon(string filename) { SHFILEINFO shFileInfoSmallIcon = new SHFILEINFO(); IntPtr hSmallIcon = WindowsAPI.SHGetFileInfo(filename, 0, ref shFileInfoSmallIcon, (uint)Marshal.SizeOf(shFileInfoSmallIcon), WindowsAPI.SHGFI_ICON | WindowsAPI.SHGFI_SMALLICON | WindowsAPI.SHGFI_USEFILEATTRIBUTES); return System.Drawing.Icon.FromHandle(shFileInfoSmallIcon.hIcon); }
public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);