Extract small icon

This article demonstrates how to extract a small icon from an application.

function GetSmallIcon(const AFile : String) : THandle;

var

  Info : TSHFileInfo;

  InfoSize : Integer;

begin

  InfoSize := SizeOf(TSHFileInfo);

  FillChar(Info, InfoSize, 0);

  SHGetFileInfo(PChar(AFile), 0, Info, InfoSize, SHGFI_ICON or SHGFI_SMALLICON);

  Result := Info.hIcon;

end;

 

Share this article!

Follow us!

Find more helpful articles: