Originally Posted by ffmla
(Post 480854)
I'll add direditonchange code.
copy and replace your code section with the following code.
Code:
var
ISDoneProgressBar: TNewProgressBar;
ISDoneCancel: integer;
ISDoneError: boolean;
MyCancelButton: TButton;
LabelCurrFileName,LabelPct,LabelTime1,LabelTime2,LabelTime3: TLabel;
//=================================================================================ISDONE
type
TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
function WrapCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';
function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ):boolean; external 'ISArcExtract@files:ISDone.dll stdcall delayload';
function IS7ZipExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'IS7zipExtract@files:ISDone.dll stdcall delayload';
function ISRarExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'ISRarExtract@files:ISDone.dll stdcall delayload';
function ISPrecompExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISPrecompExtract@files:ISDone.dll stdcall delayload';
function ISSRepExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISSrepExtract@files:ISDone.dll stdcall delayload';
function ISxDeltaExtract(CurComponent:Cardinal; PctOfTotal:double; minRAM,maxRAM:integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile, DeleteDiffFile:boolean):boolean; external 'ISxDeltaExtract@files:ISDone.dll stdcall delayload';
function ISPackZIP(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString;ComprLvl:integer; DeleteInFile:boolean):boolean; external 'ISPackZIP@files:ISDone.dll stdcall delayload';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):boolean; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall delayload';
function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@files:ISDone.dll stdcall delayload';
function ISFindFiles(CurComponent:Cardinal; FileMask:AnsiString; var ColFiles:integer):integer; external 'ISFindFiles@files:ISDone.dll stdcall delayload';
function ISPickFilename(FindHandle:integer; OutPath:AnsiString; var CurIndex:integer; DeleteInFile:boolean):boolean; external 'ISPickFilename@files:ISDone.dll stdcall delayload';
function ISGetName(TypeStr:integer):PAnsichar; external 'ISGetName@files:ISDone.dll stdcall delayload';
function ISFindFree(FindHandle:integer):boolean; external 'ISFindFree@files:ISDone.dll stdcall delayload';
function ISExec(CurComponent:Cardinal; PctOfTotal,SpecifiedProcessTime:double; ExeName,Parameters,TargetDir,OutputStr:AnsiString;Show:boolean):boolean; external 'ISExec@files:ISDone.dll stdcall delayload';
function SrepInit(TmpPath:PAnsiChar;VirtMem,MaxSave:Cardinal):boolean; external 'SrepInit@files:ISDone.dll stdcall delayload';
function PrecompInit(TmpPath:PAnsiChar;VirtMem:cardinal;PrecompVers:single):boolean; external 'PrecompInit@files:ISDone.dll stdcall delayload';
function FileSearchInit(RecursiveSubDir:boolean):boolean; external 'FileSearchInit@files:ISDone.dll stdcall delayload';
function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem:longint; callback:TCallback):boolean; external 'ISDoneInit@files:ISDone.dll stdcall';
function ISDoneStop:boolean; external 'ISDoneStop@files:ISDone.dll stdcall';
function ChangeLanguage(Language:AnsiString):boolean; external 'ChangeLanguage@files:ISDone.dll stdcall delayload';
function SuspendProc:boolean; external 'SuspendProc@files:ISDone.dll stdcall';
function ResumeProc:boolean; external 'ResumeProc@files:ISDone.dll stdcall';
#ifdef FireWall
function AddApplicationToExceptionList(path: String; name: String): Boolean; external 'AddApplicationToExceptionListA@files:FirewallInstallHelper.dll stdcall setuponly';
function RemoveApplicationFromExceptionList(path: String): Boolean; external 'RemoveApplicationFromExceptionListA@{app}\FirewallInstallHelper.dll stdcall uninstallonly';
#endif
//=================================================================================Extract
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
if OveralPct<=1000 then ISDoneProgressBar.Position := OveralPct;
LabelPct.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
LabelCurrFileName.Caption := MinimizePathName(ExpandConstant('{app}\')+CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width);
LabelTime1.Caption := ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
LabelTime2.Caption := ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
LabelTime3.Caption := ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
Result := ISDoneCancel;
end;
//=================================================================================CancelButton
procedure CancelButtonOnClick(Sender: TObject);
begin
SuspendProc;
if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
ResumeProc;
end;
//=================================================================================HideComponents
procedure HideComponents;
begin
WizardForm.FileNamelabel.Hide;
ISDoneProgressBar.Hide;
LabelPct.Hide;
LabelCurrFileName.Hide;
LabelTime1.Hide;
LabelTime2.Hide;
MyCancelButton.Hide;
end;
procedure DirEditOnChange(Sender: TObject);
begin
Wizardform.DirEdit.text := MinimizePathName(WizardForm.DirEdit.Text,WizardForm.DirEdit.Font,WizardForm.DirEdit.Width);
end;
//=================================================================================InitializeWizard
procedure InitializeWizard();
begin
//with WizardForm do begin
//DirEdit.text := MinimizePathName(WizardForm.DirEdit.Text,WizardForm.DirEdit.Font,WizardForm.DirEdit.Width);
//ComponentsDiskSpaceLabel.Visible := false;
//BorderStyle := bsSingle;
//Center;
//end;
//WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
//-------
with WizardForm.DirEdit do
begin
OnChange := @DirEditOnChange;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
end;
//-------
//=================================================================================Installing
with WizardForm.StatusLabel do
begin
Parent := WizardForm.InstallingPage;
Caption := SetupMessage(msgStatusExtractFiles);
Left := ScaleY(0);
Top := ScaleY(0);
end;
LabelCurrFileName := TLabel.Create(WizardForm);
with LabelCurrFileName do begin
Parent := WizardForm.InstallingPage;
AutoSize := False;
SetBounds(0,20,360,20);
end;
ISDoneProgressBar := TNewProgressBar.Create(WizardForm);
with ISDoneProgressBar do begin
Parent := WizardForm.InstallingPage;
SetBounds(0,40,370,20);
Max := 1000;
end;
LabelPct := TLabel.Create(WizardForm);
with LabelPct do begin
Parent := WizardForm.InstallingPage;
AutoSize := true;
Left := ScaleY(377);
Top := ScaleY(41);
end;
LabelTime1 := TLabel.Create(WizardForm);
with LabelTime1 do begin
Parent := WizardForm.InstallingPage;
SetBounds(0,69,150,20);
end;
LabelTime2 := TLabel.Create(WizardForm);
with LabelTime2 do begin
Parent := WizardForm.InstallingPage;
SetBounds(244,69,150,20);
end;
LabelTime3 := TLabel.Create(WizardForm);
with LabelTime3 do begin
Parent := WizardForm.FinishedPage;
SetBounds(175,290,300,20);
end;
MyCancelButton := TButton.Create(WizardForm);
with MyCancelButton do begin
Parent := WizardForm;
SetBounds(412,327,75,23);
Caption := 'Cancelar';
OnClick := @CancelButtonOnClick;
end;
end;
//=================================================================================CurPageChanged(CurPageID)
procedure CurPageChanged(CurPageID: Integer);
begin
MyCancelButton.Visible := CurPageID = wpInstalling;
if (CurPageID = wpFinished) then
begin
WizardForm.NextButton.SetBounds(412,327,75,23);
end;
if (CurPageID = wpFinished) and ISDoneError then
begin
LabelTime3.Hide;
WizardForm.Caption:= ExpandConstant('{cm:Error}');
WizardForm.FinishedLabel.Font.Color:= clRed;
WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ;
end;
end;
//=================================================================================CheckError
function CheckError:boolean;
begin
result := not ISDoneError;
end;
//=================================================================================CurStepChanged(CurStep)
procedure CurStepChanged(CurStep: TSetupStep);
var
path, name: String;
begin
if CurStep = ssInstall then begin
WizardForm.ProgressGauge.Hide;
WizardForm.FilenameLabel.Hide;
WizardForm.CancelButton.Hide;
ISDoneCancel:=0;
ExtractTemporaryFile('arc.ini');
ExtractTemporaryFile('unarc.dll');
ExtractTemporaryFile('zlib1.dll');
ExtractTemporaryFile('7z.exe');
ExtractTemporaryFile('7z.dll');
ExtractTemporaryFile('english.ini');
ExtractTemporaryFile('CLS-precomp.dll');
ExtractTemporaryFile('CLS-MSC.dll');
ExtractTemporaryFile('CLS-srep.dll');
ExtractTemporaryFile('facompress.dll');
ExtractTemporaryFile('facompress_mt.dll');
ExtractTemporaryFile('precomp.exe');
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('packjpg_dll1.dll');
ExtractTemporaryFile('srep64.exe');
ExtractTemporaryFile('pZLib.exe');
ExtractTemporaryFile('CallbackCtrl.dll');
ISDoneError:=true;
if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, 0,0,0, MainForm.Handle, 1024, @ProgressCallback) then begin
repeat
ChangeLanguage('English');
if not SrepInit('',512,0) then break;
if not PrecompInit('',128,0) then break;
if not FileSearchInit(true) then break;
//if not ISArcExtract ( 0, 100, ExpandConstant('{src}\*.bin'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), false) then break;
if not ISArcExtract ( 0, 100, ExpandConstant('{src}\*.bin'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), false) then break;
ISDoneError:=false;
until true;
ISDoneStop;
end;
HideComponents;
WizardForm.CancelButton.Visible:=true;
WizardForm.CancelButton.Enabled:=false;
end;
if (CurStep=ssPostInstall) and ISDoneError then begin
Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
end;
#ifdef FireWall
if CurStep = ssPostInstall then begin
path:=ExpandConstant('{app}\VanHelsing.exe');
name:=ExpandConstant('Van Helsing Final Cut');
AddApplicationToExceptionList(path, name);
end;
if CurStep = ssPostInstall then begin
path:=ExpandConstant('{app}\VanHelsing_x64.exe');
name:=ExpandConstant('Van Helsing Final Cut_x64');
AddApplicationToExceptionList(path, name);
end;
if CurStep = ssPostInstall then begin
path:=ExpandConstant('{app}\VanHelsing_x64_11.exe');
name:=ExpandConstant('Van Helsing Final Cut_x64_11');
AddApplicationToExceptionList(path, name);
end;
if CurStep = ssPostInstall then begin
path:=ExpandConstant('{app}\VanHelsing_x86.exe');
name:=ExpandConstant('Van Helsing Final Cut_x86');
AddApplicationToExceptionList(path, name);
end;
if CurStep = ssPostInstall then begin
path:=ExpandConstant('{app}\VanHelsing_x86_11.exe');
name:=ExpandConstant('Van Helsing Final Cut_x86_11');
AddApplicationToExceptionList(path, name);
#endif
end;
end;
//=================================================================================Uninstall
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
path: String;
begin
#ifdef FireWall
if CurUninstallStep=usUninstall then begin
path:=ExpandConstant('{app}\VanHelsing.exe');
RemoveApplicationFromExceptionList(path)
end;
if CurUninstallStep=usUninstall then begin
path:=ExpandConstant('{app}\VanHelsing_x64.exe');
RemoveApplicationFromExceptionList(path)
end;
if CurUninstallStep=usUninstall then begin
path:=ExpandConstant('{app}\VanHelsing_x64_11.exe');
RemoveApplicationFromExceptionList(path)
end;
if CurUninstallStep=usUninstall then begin
path:=ExpandConstant('{app}\VanHelsing_x86.exe');
RemoveApplicationFromExceptionList(path)
end;
if CurUninstallStep=usUninstall then begin
path:=ExpandConstant('{app}\VanHelsing_x86_11.exe');
RemoveApplicationFromExceptionList(path)
UnloadDll(ExpandConstant('{app}\FirewallInstallHelper.dll'));
#endif
end;
#ifdef SAVES
if CurUninstallStep = usPostUninstall then begin
if DirExists(ExpandConstant('{#SAVES}'))
then
begin
if MsgBox(ExpandConstant('{cm:del}'),mbconfirmation, mb_yesno) = IDYES then
begin
DelTree(ExpandConstant('{#SAVES}'), True, True, True);
end;
end;
end;
#endif
end;
|