JCL Help:GetSystemIcon

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Retrieves the icon at the specified index from the system imagelist.


Pascal

 function GetSystemIcon(IconIndex: Integer; Flags: Cardinal): HICON;


Parameters

Parameters Description
IconIndex: Integer The index into the system imagelist of the icon you want to retrieve.
Flags: Cardinal Flags that further specify the returned icon. This can be a combination of the SHGFI_x flags listed in the documentation of SHGetFileInfo. For example, you can set this flag to SHGFI_SMALLICON to get its small icon.


Return Value

Handle of the requested icon or 0 on failure. The caller is responsible for destroying the icon when it is no longer used. Do that by calling the DestroyIcon API function.


Description

GetSystemIcon returns the icon at specified index from the system imagelist. If the function succeeds the result is a handle to that icon, otherwise it is 0. The caller is responsible for eventually releasing the icon by calling DestroyIcon. You can use the Flags parameter to modify the behavior of this function. You can pass a combination of the flags specified in the documentation of SHGetFileInfo API function. The most used flags are: SHGFI_SMALLICON and SHGFI_LARGEICON which cause the function to return a small and large sized icon respectively. If you pass in 0 then the function sets Flags to SHGFI_SHELLICONSIZE.


About

Unit

JclShell


Donator

Marcel van Brakel


Notes

If you assign the returned handle to the Handle property of a TIcon you don't have to explicitly destroy the icon any longer. TIcon does that for you. This function requires COM to be initialized. Delphi normally does that for you but you may have to call CoInitialize yourself depending on the circumstances.


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page