[Delphi] DH Icon Changer 0.1

Iniciado por BigBear, 30 Agosto 2013, 20:31 PM

0 Miembros y 1 Visitante están viendo este tema.

BigBear

Un simple programa para cambiar el icono de otro programa.

Una imagen :



El codigo :

Código (delphi) [Seleccionar]

// DH Icon Changer 0.1
// Coded By Doddy H
// Based on IconChanger By Chokstyle
// Thanks to Chokstyle

unit icon;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, sButton, sEdit, sGroupBox, sSkinManager, ComCtrls,
  sStatusBar, ExtCtrls, madRes, jpeg, sCheckBox;

type
  TForm1 = class(TForm)
    sSkinManager1: TsSkinManager;
    sGroupBox1: TsGroupBox;
    sEdit1: TsEdit;
    sButton1: TsButton;
    sGroupBox2: TsGroupBox;
    sGroupBox3: TsGroupBox;
    sButton2: TsButton;
    sButton3: TsButton;
    sButton4: TsButton;
    sStatusBar1: TsStatusBar;
    OpenDialog1: TOpenDialog;
    sGroupBox4: TsGroupBox;
    Image1: TImage;
    sButton5: TsButton;
    OpenDialog2: TOpenDialog;
    Image2: TImage;
    sEdit2: TsEdit;
    procedure sButton1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure sButton5Click(Sender: TObject);
    procedure sButton2Click(Sender: TObject);

    procedure sButton4Click(Sender: TObject);
    procedure sButton3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin

  sSkinManager1.SkinDirectory := ExtractFilePath(Application.ExeName) + 'Data';
  sSkinManager1.SkinName := 'falloutstyle';
  sSkinManager1.Active := True;

  OpenDialog1.InitialDir := GetCurrentDir;
  OpenDialog2.InitialDir := GetCurrentDir;
  OpenDialog2.Filter := 'ICO|*.ico|';

end;

procedure TForm1.sButton1Click(Sender: TObject);
begin

  if OpenDialog1.Execute then
  begin
    sEdit1.Text := OpenDialog1.FileName;
  end;
end;

procedure TForm1.sButton2Click(Sender: TObject);
var
  op: string;
  change: dword;
  valor: string;

begin

  valor := IntToStr(128);

  op := InputBox('Backup', 'Backup ?', 'Yes');

  if op = 'Yes' then
  begin
    CopyFile(PChar(sEdit1.Text), PChar(ExtractFilePath(Application.ExeName)
          + 'backup' + ExtractFileExt(sEdit1.Text)), True);
  end;

  try
    begin
      change := BeginUpdateResourceW(PWideChar(wideString(sEdit1.Text)), false);
      LoadIconGroupResourceW(change, PWideChar(wideString(valor)), 0, PWideChar
          (wideString(sEdit2.Text)));
      EndUpdateResourceW(change, false);
      sStatusBar1.Panels[0].Text := '[+] Changed !';
      Form1.sStatusBar1.Update;
    end;
  except
    begin
      sStatusBar1.Panels[0].Text := '[-] Error';
      Form1.sStatusBar1.Update;

    end;
  end;

end;

procedure TForm1.sButton4Click(Sender: TObject);
begin
  Form1.Close();
end;

procedure TForm1.sButton5Click(Sender: TObject);
begin

  if OpenDialog2.Execute then
  begin
    Image1.Picture.LoadFromFile(OpenDialog2.FileName);
    sEdit2.Text := OpenDialog2.FileName;
  end;

end;

procedure TForm1.sButton3Click(Sender: TObject);
begin
  ShowMessage('Credits : Based on IconChanger By Chokstyle' + #13#10 + #13#10 +
      'Contact to lepuke[at]hotmail[com]');
end;

end.

// The End ?


Si quieren bajar el programa lo pueden hacer de aca.