Ветеран
Сообщения: 978
Благодарности: 564
|
Профиль
|
Сайт
|
Отправить PM
| Цитировать
actavir,
читать дальше »
Код: 
[Setup]
AppName=FreeArc Example
AppVerName=FreeArc Example 3.3 Extreme
DefaultDirName={pf}\FreeArc Example
[Files]
Source: compiler:innocallback.dll; DestDir: {tmp}; Flags: dontcopy;
[Languages]
Name: rus; MessagesFile: compiler:\Languages\Russian.isl
[CustomMessages]
rus.hour= ÷àñîâ
rus.min= ìèí
rus.sec= ñåê
[_code]
type
TTimerProc = procedure(HandleW, Msg, idEvent, TimeSys: LongWord);
var
StartInstall: Integer;
TimeLabel: TLabel;
TimerID: Longword;
function GetTickCount: DWord; external 'GetTickCount@kernel32';
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 cm(Message: String): String; Begin Result:= ExpandConstant('{cm:'+ Message +'}') End;
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('%.1n', [Abs(Ticks/1000)]) +s {less than one minute}
End;
procedure GetTime(HandleW, Msg, idEvent, TimeSys: LongWord);
var Remaining: Integer;
begin
with WizardForm.ProgressGauge do begin
if position > 0 then Remaining:= trunc((GetTickCount - StartInstall) * Abs((max - position)/position))
TimeLabel.Caption:= 'Inoaeinu ' + TicksToTime(Remaining, cm('hour'), cm('min'), cm('sec'), false)
if (Remaining = 0) then TimeLabel.Caption:= 'Çàâåðøåíèå...'
end;
end;
procedure InitializeWizard();
begin
TimeLabel:= TLabel.Create(WizardForm)
TimeLabel.SetBounds(ScaleX(0), ScaleY(80), ScaleX(457), ScaleY(20));
TimeLabel.AutoSize:= False
TimeLabel.Transparent:= True;
TimeLabel.Parent:= WizardForm.InstallingPage;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
If CurStep = ssInstall then
begin
StartInstall:= GetTickCount
TimerID:= SetTimer(0,0, 500, WrapTimerProc(@GetTime, 4))
end;
end;
procedure DeinitializeSetup();
begin
KillTimer(0, TimerID)
end;
Вот, можно пользоваться 
|
-------
Я люблю помогать. Но не путайте: "Помогите мне" и "Сделайте за меня" - это совершенно разные понятия.
Последний раз редактировалось Gnom_aka_Lexander, 27-02-2011 в 09:50.
Отправлено: 22:44, 26-02-2011
| #906
|