[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
OutputDir=.
[Code]
var
StartInstall: Integer;
TimeLabel: TLabel;
Timer: TTimer;
Function TicksToTime(Ticks: DWord; h,m,s: String; detail: Boolean): String;
Begin
if detail then {hh: mm:ss format}
Result:= PADZ(IntToStr(Ticks/3600000), 2) +':'+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +':'+ PADZ(IntToStr(Ticks/1000 - Ticks/1000/60*60), 2)
else if Ticks/3600 >= 1000 then {more than hour}
Result:= IntToStr(Ticks/3600000) +h+' '+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +m
else if Ticks/60 >= 1000 then {1..60 minutes}
Result:= IntToStr(Ticks/60000) +m+' '+ IntToStr(Ticks/1000 - Ticks/1000/60*60) +s
else Result:= Format('%.0n', [Abs(Ticks/1000)]) +s {less than one minute}
End;
procedure GetTime(Sender: TObject);
begin
StartInstall:= StartInstall+1000;
TimeLabel.Caption:= 'Elapsed ' + TicksToTime(StartInstall, ' hour', ' min', ' sec', false);
end;
procedure InitializeWizard();
begin
TimeLabel:= TLabel.Create(WizardForm)
with TimeLabel do
begin
SetBounds(0, ScaleY(80), ScaleX(457), ScaleY(20));
AutoSize:= False
Transparent:= True;
StartInstall:= 0;
Caption:= TicksToTime(StartInstall, 'hour', 'min', 'sec', true);
Font.Color:= clWhite;
Parent:= WizardForm.WelcomePage;
end;
Timer:=TTimer.Create(nil);
with Timer do begin
Interval:=1000;
OnTimer:=@GetTime;
end;
end;
//procedure CurStepChanged(CurStep: TSetupStep);
//begin
//If CurStep = ssInstall then
// begin
//
// end;
//end;
procedure DeinitializeSetup();
begin
Timer.Free;
end;