Save icons from shell32.dll Delphi source code

Source: Internet
Author: User

// 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 ----

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.