Store icons in Shell32.dll

zhaozj2021-02-11  167

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; Desktopicon: TimageList; // Do a list of images you like Implementation

{$ R * .dfm}

Procedure TForm1.FormCreate (Sender: Tobject); VAR ICO: TICON; SFI: TSHFILEINFO; I: Integer; Begin

// Assign a handle to the image list

DesktopIcon: = TImageList.Create (Self); DesktopIcon.Handle: = SHGetFileInfo ( '', 0, sfi, SizeOf (TSHFileInfo), shGFI_SYSICONINDEX or SHGFI_SMALLICON); DesktopIcon.ShareImages: = TRUE; For I: = 0 to DesktopIcon.count -1 Do Begin ICO: = Ticon.create; Desktopicon.Geticon (ICO); ICo.savetofile ('C: / ICONS /' INTOSTR (I) '. ICO'); ICO.FREE; END;

END;

Procedure TFORM1.FORMCLOSE (Sender: TpoBject; VAR Action: Tclosection); Begin Desktopicon.free;

End.

转载请注明原文地址:https://www.9cbs.com/read-5831.html

New Post(0)