GRom V Цитата: Можно ли сделать смену картинок не по таймеру, а помере выполнения установки.
Например 10% - 1.jpg, 20% - 2.jpg и.т.д.
Пример [more=здесь]
[Setup]
AppName=My Program
AppVerName=My Program
CreateAppDir=No
WindowVisible=Yes
[Files]
; Копирование *.dll для демонстрации
Source: "{sys}\*.dll"; DestDir: {tmp}; Flags: external
Source: InnoCallback.dll; DestDir: {tmp}; Flags: dontcopy
Source: pic1.bmp; DestDir: {tmp}; Flags: dontcopy
Source: pic2.bmp; DestDir: {tmp}; Flags: dontcopy
[Code]
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
var
BackgroundBitmapImage: TBitmapImage;
TimerID: LongWord;
function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';
//**************************************//
function PercentProgress(): Integer;
begin
with WizardForm.ProgressGauge do
begin
Result:= (Position-Min)/((Max - Min)/100) ;
end;
end;
procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
var
percent: integer;
begin
percent:= PercentProgress;
(* К сожалению, Inno Setup не поддерживает
задание диапазона в операторе Case. Типа:
Case X of
1 .. 10: xxx;
11 .. 20: yyy; *)
with BackgroundBitmapImage do
begin
if ((percent > 0) and (percent < 10) and (Tag <> 1)) then
begin
Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\pic1.bmp');
Tag:= 1;
end else
if ((percent > 11) and (percent < 20) and (Tag <> 2)) then
begin
Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\pic2.bmp');
Tag:= 2;
end;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
var
pfunc: LongWord;
begin
if CurPageID = wpInstalling then
begin
pfunc:= WrapTimerProc(@OnTimer, 4);
TimerID:= SetTimer(0, 0, 500, pfunc);
BackgroundBitmapImage := TBitmapImage.Create(MainForm);
with BackgroundBitmapImage do
begin
Left := 50;
Top := 100;
AutoSize := True;
Center := True;
Parent := MainForm;
Bitmap.LoadFromFile(ExpandConstant('{tmp}') + '\pic1.bmp');
Tag:= 1;
end;
end;
end;
procedure InitializeWizard();
begin
ExtractTemporaryFile('pic1.bmp');
ExtractTemporaryFile('pic2.bmp');
end;
procedure DeinitializeSetup();
begin
KillTimer(0, TimerID);
end;
[/more]
Линк на innocallback.dll можно найти постом выше.