GARANTIR DESCONTO

Fórum Copiar icone do executavel #345519

05/09/2007

0

Pessoal,

Esotu re-formulando um software meu. Eu preciso pegar o icone do executavel antigo para colocar no novo. QUal problema eu pego o icone de um executavel?

Obrigado.


Yallebr

Yallebr

Responder

Posts

05/09/2007

Maikel

Yalle.... bom dia

olhe o código abaixo... ve se isso lhe ajuda.

unit SalvaIcone;

interface

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

type
  TForm1 = class(TForm)
    OpenDialog1: TOpenDialog;
    SaveDialog1: TSaveDialog;
    GroupBox1: TGroupBox;
    Image1: TImage;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Label1: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  Image1.Picture.Icon.Handle:= ExtractIcon(Handle,PChar(OpenDialog1.FileName),0);
  BitBtn2.Enabled:=True;
  //Use a Uses Shellapi
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
  if SaveDialog1.Execute then
    Image1.Picture.SaveToFile(SaveDialog1.FileName+´.ico´);
end;

end.


Att


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar