⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit_frmchooseicon.pas

📁 传奇木马Delphi源程序
💻 PAS
字号:
unit Unit_FrmChooseIcon;

interface

uses
  Windows, Messages, SysUtils, shellapi, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, Buttons;

type
  TFrmChooseIcon = class(TForm)
    OpenDialog1: TOpenDialog;
    Label1: TLabel;
    EXE_Name: TEdit;
    GroupBox1: TGroupBox;
    Image1: TImage;
    Prev_Icon: TSpeedButton;
    Next_Icon: TSpeedButton;
    Label2: TLabel;
    GroupBox2: TGroupBox;
    Image2: TImage;
    Button1: TButton;
    Button3: TButton;
    Button2: TButton;
    procedure Extract_Icon;
    procedure Button1Click(Sender: TObject);
    procedure Prev_IconClick(Sender: TObject);
    procedure Next_IconClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmChooseIcon: TFrmChooseIcon;
  Icon_Index: integer;
implementation

{$R *.DFM}

procedure TFrmChooseIcon.Button1Click(Sender: TObject);
begin

  if OpenDialog1.Execute
    then
    begin
      EXE_Name.Text := OpenDialog1.Filename;
      Icon_Index := 0;
      Extract_Icon;
    end;
end;

procedure TFrmChooseIcon.Prev_IconClick(Sender: TObject);
begin
  if not (FileExists(EXE_Name.Text)) or (Icon_Index <= 0)
    then
    Exit;

  Icon_Index := Icon_Index - 1;
  Extract_Icon;
end;

procedure TFrmChooseIcon.Extract_Icon;
var
  icon_handle: LONGINT;
  buffer: array[0..1024] of CHAR;
begin
  if not (FileExists(EXE_Name.Text))
    then
    Exit;

  StrPCopy(Buffer, EXE_Name.Text);
  icon_handle := ExtractIcon(self.Handle, buffer, icon_index);

  if Icon_Handle = 0 {Did we get a valid handle back?}
    then
    begin {No}
      if Icon_Index = 0 {Is this the first icon in the file?}
        then {Yes. There can't be any icons in this file}
        begin
         MessageBox(Handle,'这个文件没有发现图标,请重新选择!','信息',MB_ICONINFORMATION+MB_OK);
          Image1.Visible := FALSE;
        end
      else {No. We must have gone beyond the limit. Step back}
        Icon_Index := Icon_Index - 1;
      Exit;
    end;

{We now have our extracted icon. Save it to a temp file in readiness for the modifocation}
  Image1.Picture.Icon.Handle := icon_handle;

  Image1.Visible := TRUE;
end;

procedure TFrmChooseIcon.Next_IconClick(Sender: TObject);
begin
  if not (FileExists(EXE_Name.Text))
    then
    Exit;

  Icon_Index := Icon_Index + 1;
  Extract_Icon;
end;

end.


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -