1 2 unit Unit1; 3 4 interface 5 6 uses 7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 8 Dialogs, StdCtrls; 9 10 type 11 TForm1 = class(TForm) 12 Button1: TButton; 13 Button2: TButton; 14 procedure Button1Click(Sender: TObject); 15 procedure Button2Click(Sender: TObject); 16 private 17 { Private declarations } 18 public 19 { Public declarations } 20 end; 21 22 var 23 Form1: TForm1; 24 25 implementation 26 27 {$R *.dfm} 28 procedure ChangeIcon(bChange:boolean); 29 var 30 sDir:string; 31 begin 32 sDir:='c:\winnt\'; 33 if (bChange) then 34 Application.Icon.LoadfromFile(sDir + 'Test1.ico') 35 else 36 Application.Icon.LoadfromFile(sDir + 'Test2.ico'); 37 38 end; 39 40 procedure TForm1.Button1Click(Sender: TObject); 41 begin 42 ChangeIcon(true); 43 end; 44 45 procedure TForm1.Button2Click(Sender: TObject); 46 begin 47 ChangeIcon(false); 48 end; 49 50 end. 51