unit MainForm;
{$mode delphi}
{$codepage UTF8}
interface
uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, VCLEx;
type
  { TMainFrm }
  TMainFrm = class(TForm)
   WaitBtn: TButton;
   WaitingSec: TLabel;
   WaitingIntro: TLabel;
   procedure WaitBtnClick(Sender: TObject);
  private
  public
   CurWait, OldS, NewS: Int64;
  end;
var
  MainFrm: TMainFrm;
implementation
{$R *.lfm}
{ TMainFrm }
procedure TMainFrm.WaitBtnClick(Sender: TObject);
 procedure OnWait;
 begin
 MainFrm.CurWait:= MainFrm.CurWait + 1;
 MainFrm.NewS:= MainFrm.CurWait div 1000;
 if MainFrm.NewS > MainFrm.OldS then
  begin
  MainFrm.WaitingSec.Caption:= IntToStr(MainFrm.NewS);
  MainFrm.OldS:= MainFrm.NewS;
  end;
 Application.ProcessMessages;
 end;
begin
OldS:= 0;
CurWait:= 0;
WaitingSec.Caption:= '0';
WaitEx(5000, @OnWait);
WaitingSec.Caption:= '&Stoped...';
end;
end.
