unit Unit1;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, S_Appl, ExtCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    S_ApplicationWrapper1: TS_ApplicationWrapper;
    Timer1: TTimer;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure S_ApplicationWrapper1Minimize(Sender: TObject);
    procedure S_ApplicationWrapper1Restore(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses unit2;

var
  Showed : boolean;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Showed := true;
  Timer1.Enabled := true;
  Form2.ShowModal;
  Timer1.Enabled := false;
  Showed := false;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  style : longint;
begin
  Style := GetWindowLong(Application.Handle, gwl_style);
  Style := Style or ws_caption;
  SetWindowLong(Application.Handle, gwl_style, Style);
  Showed := false;
end;

procedure TForm1.S_ApplicationWrapper1Minimize(Sender: TObject);
begin
  if Showed
  then
    Form2.Hide;
end;

procedure TForm1.S_ApplicationWrapper1Restore(Sender: TObject);
begin
  if Showed
  then
    Form2.Show;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Label1.Caption := TimeToStr(Time);
  Application.Title := Label1.Caption;
end;

end.
