Code
unit MainFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TMainForm = class(TForm)
Timer1: TTimer;
lblTmr: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
Minute:byte;
Seconds:byte;
implementation
{$R *.dfm}
procedure TMainForm.FormCreate(Sender: TObject);
begin
SetWindowPos( Handle, HWND_TOPMOST, Left, Top, Width, Height,
SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE );
Minute:=2;
Seconds:=0;
lblTmr.Caption:=IntToStr(Minute)+':'+IntToStr(Seconds);
end;
procedure TMainForm.Timer1Timer(Sender: TObject);
begin
if Seconds=0 then
begin
Seconds:=59;
Dec(Minute);
end;
Dec(Seconds);
if (Seconds=0) and (Minute=0)
then Application.Terminate
else lblTmr.Caption:=IntToStr(Minute)+':'+IntToStr(Seconds);
end;
procedure TMainForm.FormActivate(Sender: TObject);
begin
Timer1.Enabled:=true;
end;
end.