An extraction from the EXE, DLL file, access the icon complete program

zhaozj2021-02-16  34

As a programmer, it will often think for the production, design program icon. When we see many of the icons of the application software, how envo! Can we draw on their icons? absolutely okay! We can easily extract icons from the ICO file or executable, and DLL files using the Extracticon API function.

The following code demonstrates a complete extract icons, storage icon of the program: unit UFormIconGrabber; interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ShellAPI, ExtDlgs; type TForm1 = class (TForm ) Image1: TImage; btNextIcon: TButton; Label1: TLabel; EditFileName: TEdit; btBowserFile: TButton; OpenDialog1: TOpenDialog; btSaveIco: TButton; SavePictureDialog1: TSavePictureDialog; btPrevirousIcon: TButton; procedure btNextIconClick (Sender: TObject); procedure btBowserFileClick (Sender: TObject); procedure btSaveIcoClick (Sender: TObject); procedure btPrevirousIconClick (Sender: TObject); private {Private declarations} public {public declarations} Procedure MoveIconIndex (Const OperateString: String); end; var Form1: TForm1; implementation {$ R * .Dfm} Procedure TForm1.MoveiconIndex (const); const i: integer = 0; filename: String = '; var count: integer; begin if (filename <> editfilename.text) THEN Begin FileName: = editfilename.text; i: = 0; end else if operateString = 'Movenexticon' Then INC (i) else begin if i> 0 Then Dec (i); end; // Get the total icon number count: = extracticon (Application.handle, Pchar (FileName), $ ffffff); if (i

procedure TForm1.btSaveIcoClick (Sender: TObject); begin SavePictureDialog1.DefaultExt: = GraphicExtension (TIcon); SavePictureDialog1.Filter: = GraphicFilter (TIcon); if SavePictureDialog1.Execute then image1.Picture.SaveToFile (SavePictureDialog1.FileName); end; procedure TFORM1.BTPREVIROUSICONCLICK (SENDER: TOBJECT); Begin MoveiconIndex ('MovePrevicon'); end; end. OK!, So we can easily save the icon into a separate file using the timage.picturetofile method, and then use Image editor makes an appropriate amount of modifications!

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

New Post(0)