6
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7
Dialogs, StdCtrls, ComCtrls, ExtCtrls, Math;
10
TfrmProg = class(TForm)
11
prgFile: TProgressBar;
14
prgNewFile: TProgressBar;
21
procedure GetStatusProc(S: PChar; Point, Total,
22
CurrentSavings: Integer); stdcall;
23
procedure FormCreate(Sender: TObject);
25
{ Private declarations }
27
{ Public declarations }
28
FilePos,FileRange,AllPos,AllRange: Byte;
40
procedure TfrmProg.GetStatusProc(S: PChar; Point, Total, CurrentSavings: Integer); stdcall;
47
if (Total<0) then begin
49
if (Now-t2)*24*3600*10<8 then Exit; //update only every 800 milliseconds
51
if (Total>=0) then CTotal:=Total;
52
if (Total>=0) and (Point>=0) then begin
53
a:=(Point*100) div Total;
55
b:=FilePos+(a*FileRange) div 100;
56
prgNewFile.Position:=b;
57
prgAll.Position:=AllPos+(b*AllRange) div 100;
59
if (CurrentSavings>=0) and (Total>=0) then begin
60
j:=(Total-CurrentSavings)*shpFull.Width/Total;
61
shpLeft.Width:=Max(Round(j),3);
62
lblSize.Caption:=IntToStr(Total-CurrentSavings)+' of '+IntToStr(Total)+' ('+IntToStr(CurrentSavings*100 div Total)+'%)';
68
procedure TfrmProg.FormCreate(Sender: TObject);
70
FilePos:=0; FileRange:=100; AllPos:=0; AllRange:=100; CTotal:=-1;