napisałem program do zmieniania ikon, działa ale jak chce zmienić ikonę pliku exe zrobionego winrarem ikona się nie zmienia, wie ktoś co trzeba zrobić żeby program zmieniał te ikony?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls,shellapi,ABIconChanger, jpeg;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Image1: TImage;
OpenDialog1: TOpenDialog;
OpenDialog2: TOpenDialog;
GroupBox1: TGroupBox;
Image2: TImage;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var index:word;
begin
if OpenDialog1.execute then
begin
image1.Picture.bitmap:=tbitmap.create;
image1.Picture.Bitmap.Width:=40;
image1.Picture.Bitmap.Height:=40;
image1.Picture.Bitmap.Canvas.Brush.Color:=Form1.Color;
image1.Picture.Bitmap.Canvas.Rectangle(0,0,image1.Width,image1.Height);
index:=0;
DrawIcon(image1.Picture.Bitmap.Canvas.Handle,4,4,
ExtractAssociatedIcon(hinstance,Pchar(OpenDialog1.FileName),
index));
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
image1.Picture.bitmap:=tbitmap.create;
image1.Picture.Bitmap.Width:=40;
image1.Picture.Bitmap.Height:=40;
image1.Picture.Bitmap.Canvas.Brush.Color:=Form1.Color;
image1.Picture.Bitmap.Canvas.Rectangle(0,0,image1.Width,image1.Height);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if not(FileExists(OpenDialog1.FileName)) then
begin
MessageBox(handle,'Please first load icon.','Info',MB_OK or MB_ICONINFORMATION);
exit;
end;
if OpenDialog2.execute then
begin
if lowercase(ExtractFileExt(OpenDialog1.FileName))='.ico' then
ChangeIcon(OpenDialog1.FileName,OpenDialog2.FileName)
else
ChangeIcon(OpenDialog1.FileName,OpenDialog2.FileName,0)
end;
end;
end.