nik1967 Цитата: Ну так закомментировал бы
сделал бы не будь у меня дурного опыта с "затыканием" той же фигни здесь
[more]
Код: #define SrcPath "Files\"
#define Mask "*.*"
#define FindHandle
#define FindResult
#define SearchPath SrcPath + Mask
#define AllFilesSize 0
#define CurFileSize 0
[Setup]
AppName=My Program
AppVerName=My Program version 1.5
DefaultDirName={pf}\My Program
[Files]
Source: compiler:InnoCallback.dll; Flags: dontcopy
#sub ProcessFoundFile
#define FileName FindGetFileName(FindHandle)
Source: {#SrcPath}{#FileName}; DestDir: {tmp}; Flags: ignoreversion; BeforeInstall: ProgressInit(); AfterInstall: ProgressReset()
#expr CurFileSize = FileSize(SrcPath + FileName)
#expr AllFilesSize = AllFilesSize + CurFileSize
#expr WriteIni( SourcePath + "\\SizeInfo.ini","Name", FileName, CurFileSize )
#expr WriteIni( SourcePath + "\\SizeInfo.ini","Size", "AllSize", AllFilesSize )
#endsub
#for {FindHandle = FindResult = FindFirst(SearchPath, 0); FindResult; FindResult = FindNext(FindHandle)} ProcessFoundFile
Source: SizeInfo.ini; Flags: dontcopy
[Code]
type
TMsg = record
hwnd: HWnd;
msg: Word;
wParam: Word;
lParam: Word;
time: Longint;
pt: TPoint;
end;
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
var
Msg: TMsg;
TimerID: LongWord;
ProgressBar: TNewProgressBar;
CurrentFileSize: LongInt;
OneStepSize: LongInt;
OldPosition: LongInt;
ReadyFlag: Boolean;
lbl, lbl1: TLabel;
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 WrapTimerProc(callback: TProc; paramcount: Integer): Longword; external 'wrapcallback@files:innocallback.dll stdcall';
procedure ProgressInit();
begin
ProgressBar.Min:= 0;
ProgressBar.Position:= 0;
OldPosition:= WizardForm.ProgressGauge.Position;
ProgressBar.Max:= GetIniInt('Name', ExtractFileName(ExpandConstant(CurrentFileName)), 0, 0, 0, ExpandConstant('{tmp}\SizeInfo.ini'));
ReadyFlag:= True;
end;
procedure ProgressReset();
begin
ReadyFlag:= False;
end;
procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
var
res: LongWord;
begin
if ReadyFlag then
begin
ProgressBar.Position:= ProgressBar.Position + (WizardForm.ProgressGauge.Position - OldPosition) ;
OldPosition:= WizardForm.ProgressGauge.Position;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
pfunc: LongWord;
begin
if CurStep = ssInstall then
begin
pfunc:= WrapTimerProc(@OnTimer, 4);
TimerID:= SetTimer(0, 0, 20, pfunc);
end;
end;
procedure InitializeWizard();
begin
ReadyFlag:= False;
ExtractTemporaryFile('SizeInfo.ini');
ProgressBar := TNewProgressBar.Create(WizardForm);
with WizardForm.ProgressGauge do
begin
ProgressBar.Left := Left;
ProgressBar.Top := Top + ScaleX(30);
ProgressBar.Width := Width;
ProgressBar.Height := Height;
ProgressBar.Parent := WizardForm.InstallingPage;
ProgressBar.Position := 0;
end;
end;
procedure DeinitializeSetup();
begin
KillTimer(0, TimerID);
end;