#define RepackSize 57325
// 55,98 Gb, int to Mb
[Setup]
AppName=progressbar by South.Tver
AppVerName=progressbar by South.Tver
DefaultDirName={sd}\progressbar
OutputBaseFilename=setup
[Modules]
#include "Modules\botva2.iss"
#include "Modules\ProgressBar.iss"
[Files]
Source: Files\*; Flags: dontcopy
[Code]
type
TTimerProc = procedure;
var
PB1: TImgPB;
PB_pos: Byte;
Pos: array [0..1] of Boolean;
Btn: array [0..1] of TButton;
function WrapTimerProc(Callback: TTimerProc; Paramcount: Integer): Longword; external 'wrapcallbackaddr@files:callbackctrl.dll stdcall';
function SetTimer(Hwnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord; external 'SetTimer@user32.dll stdcall';
procedure GetSize;
var
size_inst, size_all: Extended;
begin
if {#RepackSize} > 1024 then begin
size_all:=({#RepackSize}/1.024)/1000;
if PB_pos <> 0 then size_inst:=(size_all*PB_pos)/100 else size_inst:=0;
WizardForm.WelcomeLabel1.Caption:=IntToStr(PB_pos)+'% '+Format('%.2n', [size_inst])+' Гб из '+ Format('%.2n', [size_all])+' Гб';
end else begin
size_all:=({#RepackSize}/1.024);
if PB_pos <> 0 then size_inst:=(size_all*PB_pos)/100 else size_inst:=0;
WizardForm.WelcomeLabel1.Caption:=IntToStr(PB_pos)+'% '+Format('%.n', [size_inst])+' Мб из '+ Format('%.n', [size_all])+' Мб';
end;
end;
procedure EditPos;
begin
if not Pos[0] and not Pos[1] then Exit;
if (PB_pos >= 0) and (PB_pos <= 100) then begin
if Pos[0] and (PB_pos > 0) then PB_pos:=PB_pos-1;
if Pos[1] and (PB_pos < 100) then PB_pos:=PB_pos+1;
ImgPBSetPosition(PB1, PB_pos);
ImgApplyChanges(WizardForm.Handle);
GetSize;
//
end;
end;
procedure OnClickDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer);
begin
if TButton(Sender) = Btn[0] then Pos[0]:=True else Pos[1]:=True;
end;
procedure OnClickUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X: Integer; Y: Integer);
begin
if TButton(Sender) = Btn[0] then Pos[0]:=False else Pos[1]:=False;
end;
procedure InitializeWizard;
var
ind: ShortInt;
begin
with WizardForm do begin
WelcomeLabel1.Parent:=WizardForm;
WelcomeLabel1.Left:=ScaleX(100);
NextButton.Width:=ScaleX(0);
InnerNotebook.Hide;
OuterNotebook.Hide;
Bevel.Hide;
//
SetTimer(0, 0, 1, WrapTimerProc(@EditPos, 4));
//
for ind:=0 to 1 do begin
Btn[ind]:=TButton.Create(nil);
with Btn[ind] do begin
if ind = 0 then Caption:='<' else Caption:='>';
if ind = 0 then Left:=ScaleX(10) else Left:=ScaleX(414);
OnMouseDown:=@OnClickDown;
OnMouseUp:=@OnClickUp;
Parent:=WizardForm;
Top:=ScaleY(250);
end;
end;
//
ImgLoad(WizardForm.Handle, 'nfs.jpg', ScaleX(0), ScaleY(0), ScaleX(WizardForm.ClientWidth), ScaleY(WizardForm.ClientHeight), True, True);
PB1:=ImgPBCreate(WizardForm.Handle, 'pbbkg.png', 'pb.png', ScaleX(100), ScaleY(251), ScaleX(WizardForm.ClientWidth-196), ScaleX(23));
ImgApplyChanges(WizardForm.Handle);
end;
end;
function InitializeSetup: Boolean;
begin
if not FileExists(ExpandConstant('{tmp}\CallbackCtrl.dll')) then ExtractTemporaryFile('CallbackCtrl.dll');
if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then ExtractTemporaryFile('botva2.dll');
Result:=True;
end;
procedure DeinitializeSetup;
begin
gdipShutdown;
end;