unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, ExtCtrls, StdCtrls;

type
  TForm2 = class(TForm)
    Timer1: TTimer;
    ProgressBar1: TProgressBar;
    Button1: TButton;
    Label1: TLabel;
    procedure FormShow(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
begin
  //desactivar butão close
  EnableMenuItem(GetSystemMenu(handle,False), SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
  //permitir outra janela sobrepor-se a esta
  SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, pointer(0), SPIF_SENDCHANGE);
end;

procedure TForm2.FormShow(Sender: TObject);
begin
  ProgressBar1.Position := 0;
  Button1.Enabled := false;
end;

procedure TForm2.Timer1Timer(Sender: TObject);
begin
  if ProgressBar1.Position < ProgressBar1.Max then
    ProgressBar1.Position := ProgressBar1.Position + 1
  else
    Button1.Enabled := true;
end;

end.
