SHGetFileInfoConstants.SHGFI_USEFILEATTRIBUTES | (int)(SHGetFileInfoConstants.SHGFI_ICON | Ref shinfo, (uint)Marshal.SizeOf(shinfo), Get the small icon and clone it, as we MUST destroy the handle when we are done.
Public static Icon GetSmallIconForExtension(string extension) SHGFI_OVERLAYINDEX = 0x000000040 // Get the index of the overlay SHGFI_ADDOVERLAYS = 0x000000020, // apply the appropriate overlays SHGFI_USEFILEATTRIBUTES = 0x10, // use passed dwFileAttribute SHGFI_SHELLICONSIZE = 0x4, // get shell size icon SHGFI_ATTR_SPECIFIED = 0x20000, // get only specified attributes SHGFI_SELECTED = 0x10000, // show icon in selected state SHGFI_LINKOVERLAY = 0x8000, // put a link overlay on icon
SHGFI_SYSICONINDEX = 0x4000, // get system icon index SHGFI_EXETYPE = 0x2000, // return exe type SHGFI_ICONLOCATION = 0x1000, // get icon location SHGFI_ATTRIBUTES = 0x800, // get attributes
SHGFI_DISPLAYNAME = 0x200, // get display name Private enum SHGetFileInfoConstants : int Private const int FILE_ATTRIBUTE_NORMAL = 0x80 Private static extern IntPtr SHGetFileInfo( I have the belows methods which are working for obtaining small 16x16 and large 32x32 images. I have found various articles on getting the system images for a file or even file extension.