// Cust and paste into a new application and the output will
// Be placed in a folder called c: \ icons
// ---------------------------- Cut -----
Unit unit1;
Interface
Uses
Windows, messages, sysutils, classes, graphics, controls, forms, shellapi, dialogs;
Type
Tform1 = Class (tform)
Procedure formcreate (Sender: tobject );
Procedure formclose (Sender: tobject; var action: tcloseaction );
Private
{Private Declarations}
Public
{Public declarations}
End;
VaR
Form1: tform1;
Required topicon: timagelist; // I LOVE YOU imagelist
Implementation
{$ R *. DFM}
Procedure tform1.formcreate (Sender: tobject );
VaR ICO: ticon;
SFI: tshfileinfo;
I: integer;
Begin
// Assign handle to imagelist
Required topicon: = timagelist. Create (Self );
Required topicon. Handle: = shgetfileinfo ('', 0, SFI, sizeof (tshfileinfo ),
Shgfi_sysiconindex or shgfi_smallicon );
Required topicon. Required images: = true;
For I: = 0 to operate topicon. Count-1 do
Begin
ICO: = ticon. Create;
Using topicon. getIcon (I, ico );
ICO. savetofile ('C: \ icons \ '+ inttostr (I) +'. ICO ');
ICO. Free;
End;
End;
Procedure tform1.formclose (Sender: tobject; var action: tcloseaction );
Begin
Optional topicon. Free;
End;
End.
// --------------------- Paste ----