unit Unit1; //ale widzi tylko 1 ikonę!!!

 

interface

 

uses

  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

  StdCtrls, ExtCtrls, ShellApi;

 

type

  TForm1 = class(TForm)

    Image1: TImage;

    Button1: TButton;

    Label1: TLabel;

    EditNazwaPliku: TEdit;

    OpenDialog1: TOpenDialog;

    SaveDialog1: TSaveDialog;

    Button2: TButton;

    Button3: TButton;

    procedure Button1Click(Sender: TObject);

    procedure Button2Click(Sender: TObject);

    procedure Button3Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

    procedure nextIcon;

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.DFM}

 

procedure TForm1.NextIcon;

const

I: Integer=0;

NazwaPliku:String='';

var

Licznik: Integer;

begin

if (NazwaPliku <> EditNazwaPliku.Text) then

begin

NazwaPliku:=OpenDialog1.FileName;

I:=0;

end

else

Inc(I);

 

Licznik:=ExtractIcon(application.handle, PChar(NazwaPliku),

$FFFFFFFF);

if  (I<licznik) then

Image1.Picture.Icon.Handle:=ExtractIcon(application.handle, PChar(NazwaPliku),I)

else

ShowMessage('Brak następnych rysunków');

end;

 

procedure TForm1.Button1Click(Sender: TObject);

begin

nexticon;

end;

 

procedure TForm1.Button2Click(Sender: TObject);

begin

if SaveDialog1.Execute then begin

Image1.Picture.SaveToFile(SaveDialog1.Filename);

end;

end;

 

 

procedure TForm1.Button3Click(Sender: TObject);

const

I: Integer=0;

begin

if OpenDialog1.Execute then begin

Image1.Picture.Icon.Handle:=ExtractIcon(application.handle, PChar(OpenDialog1.FileName),I);

(*Image1.Picture.LoadFromFile(OpenDialog1.Filename);*)

end;

end;

 

end.