[Setup] AppName=MyApp AppVerName=MyApp DefaultDirName={pf}\MyApp Compression=lzma2/ultra [Files] Source: innocallback.dll; Flags: dontcopy Source: Setup\*; DestDir: {app}; Flags: recursesubdirs ignoreversion overwritereadonly; [code] type TTimerProc = procedure(HandleW, Msg, idEvent, TimeSys: LongWord); var PercentsTimer: LongWord; PercentsLabel: TLabel; function WrapTimerProc(callback: TTimerProc; Paramcount: Integer): longword; external 'wrapcallback@files:innocallback.dll stdcall'; function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): longword; external 'SetTimer@user32'; function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32 stdcall delayload'; Function NumToStr(Float: Extended): String; Begin Result:= Format('%.n', [Float]); StringChange(Result, ',', '.'); while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do SetLength(Result, Length(Result)-1); End; Procedure PercentsProc(h, msg, idevent, dwTime: Longword); Begin with WizardForm.ProgressGauge do begin PercentsLabel.Caption:= 'Выполнено ' + NumToStr((Position*100)/Max) + ' %'; end; End; procedure DeinitializeSetup(); begin KillTimer(0, PercentsTimer); end; procedure InitializeWizard(); begin PercentsLabel:= TLabel.Create(WizardForm); with PercentsLabel do begin Left:= WizardForm.ProgressGauge.Left; Top:= WizardForm.ProgressGauge.Top + WizardForm.ProgressGauge.Height + ScaleY(10); Width:= WizardForm.StatusLabel.Width; Height:= WizardForm.StatusLabel.Height; AutoSize:= False; Transparent := True; Parent:= WizardForm.InstallingPage; end; end; procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssInstall then begin PercentsTimer:= SetTimer(0, 0, 100, WrapTimerProc(@PercentsProc, 4)); end; end; |