0

I do a number of checks in the InitializeSetup function in my script. These take about 10 seconds to complete, during which time nothing is displayed except for the window button on the taskbar (clicking it yields nothing). I would like to show a simple "Please wait" window instead. How can I do this?

Tamás Szelei
  • 23,169
  • 18
  • 105
  • 180

1 Answers1

4

Here is sample script that shows how you can create a custom dialog.

Basically create a custom form and place the custom control on it. You can use this as starting point to get the dialog appear as you wish.

[Setup]
AppName='Test Date Script'
AppVerName='Test Date Script'
DefaultDirName={pf}\test

[Code]

function InitializeSetup() : boolean;
var
  DlgWait : TSetupForm;
  lblWait : TLabel;
  I : Integer;
begin
  dlgWait :=  CreateCustomForm;
  dlgWait.FormStyle := bsDialog;
  dlgWait.Position := poMainFormCenter;
  lblWait := TLabel.Create(dlgWait);
  lblWait.Parent := dlgWait;
  lblWait.Caption := 'Please Wait';
  lblWait.Visible := True;
  dlgWait.Show;
  dlgWait.Refresh; // Process the paint message

  for I := 0 to 10 do
  begin
     Sleep(1000); // Simulate Functions taking 10 sec
     dlgWait.Refresh;
  end;

  DlgWait.Free;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Robert Love
  • 12,447
  • 2
  • 48
  • 80
  • Is it possible to show the window in its own thread? It doesn't help much if you refresh after every iteration since it will be frozen most of the time. – Tamás Szelei May 20 '11 at 12:19