Ветеран
Сообщения: 978
Благодарности: 564
|
Профиль
|
Сайт
|
Отправить PM
| Цитировать
к слову об установке приложений с помощью IsDone;
читать дальше »
Код: 
#define NeedMem 512
#define records
[Setup]
AppName=SisMin
AppVerName=SisMin
OutputBaseFilename=SisMin
VersionInfoCopyright=ProFrager
SolidCompression=true
CreateAppDir=false
Compression=none
ShowLanguageDialog=no
LanguageDetectionMethod=locale
ShowComponentSizes=false
FlatComponentsList=false
UsePreviousTasks=false
ShowTasksTreeLines=true
ShowUndisplayableLanguages=true
Uninstallable=false
DisableProgramGroupPage=yes
UsePreviousGroup=false
AppendDefaultGroupName=false
AlwaysRestart=true
[CustomMessages]
otherGroup=Прочее:
pointDesc=Создать системную контрольную точку (рекомендуется)
pointMsg=Создание контрольной точки...
[Tasks]
Name: restorepoint; Description: {cm:pointDesc}; GroupDescription: {cm:otherGroup}; MinVersion: 0,5.1
[Types]
Name: full; Description: "Полная установка"; Flags: IsCustom;
Name: compact; Description: "Компактная установка";
Name: custom; Description: "Выборочная установка";
[Components]
Name: dllsfox; Description: Набор библиотек Visual Fox Pro 3, 5, 6, 7, 8 и 9 версий;Types: full;
Name: dllsfull; Description: Набор Runtime библиотек, необходимых для работы различных программ.;Types: full;
Name: DirectX; Description: Набор библиотек DirectX;Types: full;
Name: Java; Description: Расширенный набор Oracle Java.;Types: full;
Name: stdu; Description: Программа для просмотра, файлов DjVu, TIFF, PDF.; Types: full;
Name: msxml4; Description: MSXML 4 SP3 - обновленная версия XML-парсера; Types: full;
Name: Flash; Description: Adobe Flash Player ActiveX и Adobe Flash Player Plugin; Types: full;
Name: RuntimePack; Description: Расширенный набор библиотек Microsoft Visual C++; Types: full;
Name: dotNet; Description: Microsoft .NET Framework 3.5.1- 4.0 Full; Types: full;
Name: PhysX; Description: NVIDIA® PhysX®; Types: full;
Name: R262; Description: Аудиодрайвер Realtek.;Types: full;
Name: Lan; Description: Сетевой драйвер Realtek;Types: full;
[Files]
Source: Include\*; Flags: dontcopy
Source: exe\*; DestDir: {tmp}
#ifdef records
Source: records.inf; Flags: dontcopy
#endif
[CustomMessages]
russian.ExtractedFile=Устанавливается:
russian.Extracted=Установка системных компонентов...
russian.Error=Ошибка!
russian.ElapsedTime=Прошло:
russian.RemainingTime=Осталось времени:
russian.EstimatedTime=Всего:
russian.AllElapsedTime=Время установки:
[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl
[UninstallDelete]
Type: filesandordirs; Name: {app}
[*Code]
const
APPLICATION_INSTALL = 0;
APPLICATION_UNINSTALL = 1;
DEVICE_DRIVER_INSTALL = 10;
MODIFY_SETTINGS = 12;
CANCELLED_OPERATION = 13;
BEGIN_SYSTEM_CHANGE = 100;
END_SYSTEM_CHANGE = 101;
BEGIN_NESTED_SYSTEM_CHANGE = 102;
END_NESTED_SYSTEM_CHANGE = 103;
var
LblPct, LblTime : array[0..1]of TLabel;
ISDonePB : array[0..1]of TNewProgressBar;
ISDoneCancel:integer;
ISDoneError:boolean;
type
TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
function SetRestorePoint(const PointName: string): Boolean;
var
vObj, SR: Variant;
begin
vObj := CreateOleObject('ScriptControl');
vObj.Language := 'VBScript';
SR := vObj.eval('GetObject("winmgmts:\\.\root\default:SystemRestore")');
Result := SR.CreateRestorePoint(PointName, APPLICATION_INSTALL, BEGIN_SYSTEM_CHANGE) = 0;
end;
function WrapCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';
function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@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 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:string):boolean; external 'ChangeLanguage@files:ISDone.dll stdcall';
function SuspendProc:boolean; external 'SuspendProc@files:ISDone.dll stdcall';
function ResumeProc:boolean; external 'ResumeProc@files:ISDone.dll stdcall';
function GetModuleHandle(ModuleName:PAnsiChar):Cardinal; external 'GetModuleHandleA@kernel32.dll stdcall';
function FreeLibrary(Handle:cardinal):bool; external 'FreeLibrary@kernel32.dll stdcall';
function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
if OveralPct<=1000 then ISDonePB[0].Position := OveralPct;
if CurrentPct<=1000 then ISDonePB[1].Position := CurrentPct;
LblPct[0].Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
LblPct[1].Caption := IntToStr(CurrentPct div 10)+'.'+chr(48 + CurrentPct mod 10)+'%';
LblTime[0].Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
LblTime[1].Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
WizardForm.FilenameLabel.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, WizardForm.FilenameLabel.Font, WizardForm.FilenameLabel.Width-ScaleX(100));
Result := ISDoneCancel;
end;
procedure CreateControls;
var
i : integer;
begin
for i := 0 to 1 do
begin
ISDonePB[i] := TNewProgressBar.Create(WizardForm);
with ISDonePB[i] do begin
Parent := WizardForm.InstallingPage;
SetBounds(ScaleX(0), ScaleY(80+i*40), ScaleX(417), ScaleY(21));
Max := 1000;
end;
LblTime[i] := TLabel.Create(WizardForm);
with LblTime[i] do begin
Parent := ISDonePB[i];
Transparent := True;
AutoSize := False;
SetBounds(ScaleX(5), ScaleY(3), ScaleX(412), ScaleY(14));
end;
LblPct[i] := TLabel.Create(WizardForm);
with LblPct[i] do begin
Parent := ISDonePB[i];
Transparent := True;
Alignment := taRightJustify;
AutoSize := False;
SetBounds(ScaleX(0), ScaleY(3), ScaleX(412), ScaleY(14));
end;
end;
with WizardForm do
begin
StatusLabel.SetBounds(ScaleX(0), ScaleY(63), ScaleX(417), ScaleY(21));
FilenameLabel.SetBounds(ScaleX(0), ScaleY(103), ScaleX(417), ScaleY(21));
FilenameLabel.Show;
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
Begin
if (CurPageID = wpFinished) and ISDoneError then
begin
with WizardForm do
begin
Caption:= ExpandConstant('{cm:Error}');
FinishedLabel.Font.Color:= clRed;
FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ;
end;
end;
end;
function CheckError:boolean;
begin
result:= not ISDoneError;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
msg: string;
Comps1, Comps2, Comps3, TmpValue :cardinal;
begin
if CurStep = ssInstall then
begin
WizardForm.StatusLabel.SetBounds(ScaleX(0), ScaleY(27), ScaleX(417), ScaleY(21));
WizardForm.FilenameLabel.Hide;
if IsTaskSelected('restorepoint') then
begin
try
msg := WizardForm.StatusLabel.Caption;
WizardForm.StatusLabel.Caption := ExpandConstant('{cm:pointMsg}');
WizardForm.Repaint;
// создаём контрольную точку
SetRestorePoint('Установка {#SetupSetting("AppName")}');
WizardForm.StatusLabel.Caption := msg;
finally
SetLength(msg, 0);
end;
end;
end;
if CurStep = ssPostInstall then
begin
#ifdef records
ExtractTemporaryFile('records.inf');
#endif
Comps1:=0; Comps2:=0; Comps3:=0;
TmpValue:=1;
if IsComponentSelected('msxml4') then Comps1:=Comps1+TmpValue; //компонент 1
TmpValue:=TmpValue*2;
if IsComponentSelected('dllsfox') then Comps1:=Comps1+TmpValue; //компонент 2
TmpValue:=TmpValue*2;
if IsComponentSelected('dllsfull') then Comps1:=Comps1+TmpValue; //компонент 3
TmpValue:=TmpValue*2;
if IsComponentSelected('Flash') then Comps1:=Comps1+TmpValue; //компонент 4
TmpValue:=TmpValue*2;
if IsComponentSelected('Java') then Comps1:=Comps1+TmpValue; //компонент 5
TmpValue:=TmpValue*2;
if IsComponentSelected('DirectX') then Comps1:=Comps1+TmpValue; //компонент 6
TmpValue:=TmpValue*2;
if IsComponentSelected('RuntimePack') then Comps1:=Comps1+TmpValue; //компонент 7
TmpValue:=TmpValue*2;
if IsComponentSelected('stdu') then Comps1:=Comps1+TmpValue; //компонент 8
TmpValue:=TmpValue*2;
if IsComponentSelected('dotNet') then Comps1:=Comps1+TmpValue; //компонент 9
TmpValue:=TmpValue*2;
if IsComponentSelected('PhysX') then Comps1:=Comps1+TmpValue; //компонент 10
TmpValue:=TmpValue*2;
if IsComponentSelected('R262') then Comps1:=Comps1+TmpValue; //компонент 11
TmpValue:=TmpValue*2;
if IsComponentSelected('Lan') then Comps1:=Comps1+TmpValue; //компонент 12
CreateControls;
WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
ISDoneCancel:=0;
ISDoneError:=true;
if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, MainForm.Handle, {#NeedMem}, @ProgressCallback) then
begin
repeat
if not ISExec ( 1, 0, 0, ExpandConstant('{tmp}\dllsfox.exe'), ' -y -gm2 -fm0', ExpandConstant('{tmp}'), 'Набор DLL Visual Fox Pro',false) then break;
if not ISExec ( 2, 0, 0, ExpandConstant('{tmp}\dllsfull.exe'), ' -y -gm2 -fm0', ExpandConstant('{tmp}'), 'Набор Runtime DLL',false) then break;
if not ISExec ( 3, 0, 0, ExpandConstant('{tmp}\DirectX.exe'), ' /S', ExpandConstant('{tmp}'), 'Набор библиотек DirectX',false) then break;
if not ISExec ( 4, 0, 0, ExpandConstant('{tmp}\Java.exe'), ' /S', ExpandConstant('{tmp}'), 'Расширенный набор Oracle Java',false) then break;
if not ISExec ( 5, 0, 0, ExpandConstant('{tmp}\stdu.exe'), ' /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-', ExpandConstant('{tmp}'), 'Программа для просмотра, файлов DjVu, TIFF, PDF',false) then break;
if not ISExec ( 6, 0, 0, ExpandConstant('{tmp}\msxml4.exe'),' /passive', ExpandConstant('{tmp}'), 'MSXML 4 SP3',false) then break;
if not ISExec ( 7, 0, 0, ExpandConstant('{tmp}\Flash.exe'),'', ExpandConstant('{tmp}'), 'Adobe Flash Player ActiveX и Adobe Flash Player Plugin',false) then break;
if not ISExec ( 8, 0, 0, ExpandConstant('{tmp}\VCRedist.exe'), ' /S', ExpandConstant('{tmp}'), 'Расширенный набор библиотек Microsoft Visual C++',false) then break;
if not ISExec ( 9, 0, 0, ExpandConstant('{tmp}\dotNet.exe'), ' -aiqlku', ExpandConstant('{tmp}'), 'Microsoft .NET Framework 3.5.1- 4.0 Full',false) then break;
if not ISExec ( 10, 0, 0, ExpandConstant('{tmp}\PhysX.exe'), ' /Q', ExpandConstant('{tmp}'), 'NVIDIA® PhysX®',false) then break;
if not ISExec ( 11, 0, 0, ExpandConstant('{tmp}\R262.exe'), '', ExpandConstant('{tmp}'), 'Аудиодрайвер Realtek',false) then break;
if not ISExec ( 12, 0, 0, ExpandConstant('{tmp}\Lan.exe'), '', ExpandConstant('{tmp}'), 'Сетевой драйвер Realtek',false) then break;
ISDoneError:=false;
until true;
ISDoneStop;
end;
end;
end;
R.i.m.s.k.y., Johny777, а сколько кода (приплюсуем сюда тормоза, которые внесет виртуальная машина Inno) займет у Вас установка десятка приложений, с отображением установки каждого на отдельном прогрессбаре, и всех выбранных на общем?
|