ImageEn, unit iexShellThumbnails



function WindowsGetFileIcon(const Filename : String; var aIcon : TIcon; IconSize : Cardinal = SHIL_JUMBO) : Boolean; overload;
function WindowsGetFileIcon(const Filename : string; DestBitmap : TIEBitmap; IconSize : Cardinal = SHIL_JUMBO) : Boolean; overload;


Returns the icon for the specified file, either as a TIEBitmap or a TIcon.

Values of IconSize:
Item Description
SHIL_SMALL ($01) Images are Shell standard small icon size of 16x16
SHIL_LARGE ($00) Image size is normally 32x32 pixels or 48x48 pixels
SHIL_EXTRALARGE ($02) Images are the Shell standard extra-large icon size, which is typically 48x48
SHIL_JUMBO ($04) Image size is normally 256x256 pixels
SHIL_SYSSMALL ($03) Image size is specified by GetSystemMetrics called with SM_CXSMICON and GetSystemMetrics called with SM_CYSMICON

Result is false if the icon cannot be retrieved.


// Return a high-quality icon for Notepad
WindowsGetFileIcon( 'C:\Windows\notepad.exe', ImageEnView1.IEBitmap, SHIL_JUMBO );

See Also

- WindowsGetExplorerThumbnail
- WindowsGetStockIcon
- WindowsGetSystemImageList