Inno Setup (создание инсталяционных пакетов). Часть 3

Статус
В этой теме нельзя размещать новые ответы.

y_thelastknight

Мимокрокодил
y_thelastknight,
1.http://krinkels.org/downloads.php?do=file&id=83

2.
Код:
var
StatLabel: TLabel;

type
 TTimerProc=procedure(h:longword; msg:longword; idevent:longword; dwTime:longword);

function SetTimer(hWnd: longword; nIDEvent, uElapse: longword; lpTimerFunc: longword): longword; external 'SetTimer@user32.dll stdcall';
function wsprintf( a:ansistring; b:ansistring; c:TTimerProc ): longword; external 'wsprintfA@user32.dll cdecl';
function memcpy( a:longword; c:ansistring; l:longword ): longword; external 'memcpy@msvcrt.dll cdecl';
function VirtualAlloc( a:longword; b:longword; c:longword; d:longword ): longword; external 'VirtualAlloc@kernel32.dll stdcall';
function sh_wrap( u: TTimerProc ): longword;
var
  x,y,cb: longword;
  s: ansistring;
begin
 SetLength( s, 256 );
 wsprintf( s, '%i %i;', u );
 x := StrToInt( Copy(s,1,Pos(' ',s)-1) );
 Delete( s, 1, Pos(' ',s) );
 y := StrToInt( Copy(s,1,Pos(';',s)-1) );
 s := chr(85)+chr(139)+chr(236)+chr(104)+chr(x)+chr(x shr 8)+chr(x shr 16)+chr(x shr 24)+chr(139)+chr(85)+chr(8)+chr(139)+chr(77)+chr(12)+chr(255)+chr(181)+chr(16)+chr(0)+chr(0)+chr(0)+chr(255)+chr(181)+chr(20)+chr(0)+chr(0)+chr(0)+chr(184)+chr(y)+chr(y shr 8)+chr(y shr 16)+chr(y shr 24)+chr(255)+chr(85)+chr(252)+chr(90)+chr(93)+chr(194)+chr(16)+chr(0);
 cb := VirtualAlloc( 0, $2000, $1000, $40 );
 memcpy( cb, s, Length(s) );
result := cb;
end;

Procedure mytimerproc1(h:longword; msg:longword; idevent:longword; dwTime:longword);
Begin
    StatLabel.Caption:=WizardForm.FileNamelabel.Caption;
End;

procedure InitializeWizard();
begin
  StatLabel:= TLabel.Create(WizardForm);
  StatLabel.Parent:= WizardForm.InstallingPage;
  StatLabel.AutoSize:= true;
  StatLabel.SetBounds(ScaleX(20), ScaleY(100), ScaleX(250), ScaleY(18));
  StatLabel.Transparent:= true;
  StatLabel.WordWrap:= false;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID=wpInstalling
then
begin
WizardForm.FileNamelabel.Hide;
settimer(0,0,1,sh_wrap(@mytimerproc1));
end;
end;
Im using the 2nd..
both script are work fine
Thank you Snoopak96
 

Mailchik

Старожил
Проверенный
MAKS_MAFIA, код...
 

vint56

Ветеран
Проверенный
Бахытжан ты узнай как идёт смена локализаций через реестр или через ini файл
 

mix1

Новичок
подскажите,что не так прописал,создал репак,скрипт,отредактировал,установка проходит без проблем,Но ярлык не создаётся!!!!:help:
 

MAKS_MAFIA

Новичок
У меня вылазит ошибка: Не найдено ни одного файла, указанного для ISArcExtract
 
Последнее редактирование:

urban

Старожил
mix1,
[Icons]
Name: {group}\Far Cry 3 Blood Dragon; Filename: {app}\bin\FC3BDUpdater.exe; WorkingDir: {app};

MAKS_MAFIA,
if not ISArcExtract ( 0, 0, ExpandConstant('{src}\data-2.cab'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
вместо выделеного,свой архив
 

mix1

Новичок
urban,

В какой строке прописывать?

Можете выделить наглядно?
 

Adil

Старожил
mix1
[SOURCE="inno"]#define MyAppName "Far Cry 3 Blood Dragon"
#define MyAppVersion "1.5"
#define MyAppPublisher "Ubisoft"
#define MyAppURL "http://www.Ubisoft.com/"
#define MyAppExeName "FC3BDUpdater.exe"

[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "default"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\bin\{#MyAppExeName}; WorkingDir: {app}\bin\;
Name: {commondesktop}\{#MyAppName}; Filename: {app}\bin\{#MyAppExeName}; WorkingDir: {app}\bin\; Tasks: desktopicon[/SOURCE]
urban, у тебя вроде ошибка, должно быть так
[SOURCE="inno"][Icons]
Name: {group}\Far Cry 3 Blood Dragon; Filename: {app}\bin\FC3BDUpdater.exe; WorkingDir: {app}\bin\;[/SOURCE]
 

MAKS_MAFIA

Новичок
MAKS_MAFIA,
весь код покажи,path это что-то связаное с путем
Код:
#define AppID                       "{267C9423-0839-4E91-83CC-8B0B1D0A97D3}"
#define MyAppName "KPAH Mod Pack 0.8.6"
#define MyAppVersion "KPAHModPack_0.8.6_v3.0"
#define NeedMem 512
#define NeedSize                    "5894"
#define TotalNeedSize               "5894"
#define FinishImage                 "3.bmp"
#define FirewallInstallHelper
;-------------------------------------------------------------------
; Компоненты, если не нужны, то закомментировать строку
#define Components
;-------------------------------------------------------------------
; Строку Records раскомментировать после тестового прогона см. инструкцию к ISDone (для ISDone)
;#define records
;-------------------------------------------------------------------
; Ускорение распаковки архивов, если не нужно - закомментировать (для ISDone)
#define facompress
;-------------------------------------------------------------------
; Кнопка "Отмена" на странице приветствия, если не нужно - закомментировать
#define CancelOnWelcome
;-------------------------------------------------------------------
; Описание компонентов, если не нужно - закомментировать
#define ComponentsInfo
;-------------------------------------------------------------------

;Дополнительные библиотеки (для ISDone)

;#define PrecompInside
;#define SrepInside
;#define MSCInside
;#define precomp "0.42"
;#define unrar
;#define XDelta
;#define PackZIP

[Setup]
AppID={#AppId}
AppName={#MyAppName}
AppVerName=KPAHModPack_0.8.6_v3.0
DefaultDirName=C:\Game\World of Tanks
OutputDir=C:\Users\Администратор\Desktop
OutputBaseFilename=KPAHModPack_0.8.6_v3.0
AllowNoIcons=true
SetupIconFile=K:\KPAH\MODPACK\wot_ico.ico
VersionInfoCopyright=Dr.DLL
Compression=none
SolidCompression=true
WizardImageFile=Files\1.bmp
WizardSmallImageFile=Files\2.bmp
;DirExistsWarning=no
UninstallFilesDir={app}\Uninstall
ShowTasksTreeLines=true
#ifdef NeedSize
ExtraDiskSpaceRequired=0
#endif
DisableReadyPage=true
DisableProgramGroupPage=no

#ifdef Components
[Types]
Name: custom; Description: Full installation; Flags: iscustom

[Components]
Name: KMP; Description: KPAH Mod Pack; Types: custom; Flags: fixed
Name: KMP\P; Description: 1. Прицел.;
Name: KMP\DP; Description: 2. Дамаг панель.;
Name: KMP\Z; Description: 3. Zoom.;
Name: KMP\Z\NS; Description: а. NoScroll- колёсико не переключает в снайперский режим; Flags: checkablealone ;
Name: KMP\Z\ZX4; Description: б. 4-х позиционный снайперский прицел ; Flags: checkablealone ;
Name: KMP\T; Description: 4. Дерево развития.;
Name: KMP\I; Description: 5. Информационная панель выбранной цели.;
Name: KMP\CM; Description: 6. Цветные сообщения(ЯсенКрасен).;
Name: KMP\CLOCK; Description: 7. Часы в ангаре.;
Name: KMP\A; Description: 8. Ангар.;
Name: KMP\XVM; Description: 9. Пользомер(Оленемер).; 
#endif

[Files]
Source: "K:\KPAH\MODPACK\MODS\PRICEL\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\P;
Source: "K:\KPAH\MODPACK\MODS\DAMAGEPANEL\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\DP;
Source: "K:\KPAH\MODPACK\MODS\ZOOM\COMANDOR\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\Z;
Source: "K:\KPAH\MODPACK\MODS\ZOOM\NOSCROLL\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\Z\NS;
Source: "K:\KPAH\MODPACK\MODS\ZOOM\ZOOM4X\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\Z\ZX4;
Source: "K:\KPAH\MODPACK\MODS\TREE\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\T;
Source: "K:\KPAH\MODPACK\MODS\INFO\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\I;
Source: "K:\KPAH\MODPACK\MODS\COLORMESENGER\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\CM;
Source: "K:\KPAH\MODPACK\MODS\CLOCK\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\CLOCK;
Source: "K:\KPAH\MODPACK\MODS\ANGAR\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\A;
Source: "K:\KPAH\MODPACK\MODS\XVM\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: KMP\XVM;
Source: Include\English.ini; DestDir: {tmp}; Flags: dontcopy
Source: Include\unarc.dll; DestDir: {tmp}; Flags: dontcopy
Source: ISDone.dll; DestDir: {tmp}; Flags: dontcopy
#ifdef records
Source: records.inf; DestDir: {tmp}; Flags: dontcopy
#endif

#ifdef PrecompInside
Source: Include\CLS-precomp.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packjpg_dll.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packjpg_dll1.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\precomp.exe; DestDir: {tmp}; Flags: dontcopy
Source: Include\zlib1.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef SrepInside
Source: Include\CLS-srep.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef MSCInside
Source: Include\CLS-MSC.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef facompress
Source: Include\facompress.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef precomp
  #if precomp == "0.38"
  Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
  #else
    #if precomp == "0.4"
    Source: Include\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
    #else
      #if precomp == "0.41"
      Source: Include\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
      #else
        #if precomp == "0.42"
        Source: Include\precomp042.exe; DestDir: {tmp}; Flags: dontcopy
        #else
        Source: Include\precomp038.exe; DestDir: {tmp}; Flags: dontcopy
        Source: Include\precomp040.exe; DestDir: {tmp}; Flags: dontcopy
        Source: Include\precomp041.exe; DestDir: {tmp}; Flags: dontcopy
        Source: Include\precomp042.exe; DestDir: {tmp}; Flags: dontcopy
        #endif
      #endif
    #endif
  #endif
#endif
#ifdef unrar
Source: Include\Unrar.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef XDelta
Source: Include\XDelta3.dll; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef PackZIP
Source: Include\7z.dll; DestDir: {tmp}; Flags: dontcopy
Source: Include\packZIP.exe; DestDir: {tmp}; Flags: dontcopy
#endif
#ifdef FirewallInstallHelper
Source: Files\FirewallInstallHelper.dll; DestDir: {app}; Flags: ignoreversion
#endif
Source: Files\{#FinishImage}; DestDir: {tmp}; Flags: dontcopy 
Source: Files\iswin7.dll; DestDir: {tmp}; Flags: dontcopy
Source: Files\Logo.bmp; DestDir: {tmp}; Flags: dontcopy
Source: Files\descctrl.dll; DestDir: {tmp}; Flags: dontcopy

[CustomMessages]
russian.Extracted=Распаковка локального кэша ...
russian.Error=Установка — {#MyAppName}
russian.ElapsedTime=Прошло:
russian.RemainingTime=Осталось времени:
russian.EstimatedTime=Всего:
russian.FinishLabel={#MyAppName} установлена на Ваш компьютер.
russian.WelcomeLabel=Программа установит {#MyAppName} на Ваш компьютер.
russian.FinishedLabel=Установка {#MyAppName} была прервана.
russian.DeleteSave=Удалить сохраненные игры и профили?

[Languages]
Name: russian; MessagesFile: Files\Russian.isl

[UninstallDelete]
Type: filesandordirs; Name: {app}

[ Code]
const
PCFonFLY=true;
notPCFonFLY=false;
var 
WelcomeLabel, FinishedLabel, PageNameLabel: TLabel; 
TotalNeedSpaceLabel,NeedSpaceLabel,FreeSpaceLabel: TLabel; 
LabelPct1,LabelTime1,LabelTime2: TLabel;
FreeMB, TotalMB: Cardinal; 
SizeStr: String; 
SizeInt: Integer; 
SymbolNumber: Integer; 
NeedSize, TotalNeedSize, ISDoneCancel: Integer;
ISDoneProgressBar1: TNewProgressBar;
MyCancelButton: TButton;
ISDoneError:boolean;
PCFVer:double;
BtnPanel: TPanel;
BtnImage: TBitmapImage;
Info: TNewStaticText;
InfoCaption: TNewStaticText;
InfoPanel: TPanel;

Function NumToStr(Float: Extended): String; 
Begin 
  Result:= Format('%.2n', [Float]); StringChange(Result, ',', '.'); 
  while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do 
  SetLength(Result, Length(Result)-1); 
End; 
 
function GetSize(): Integer; 
begin 
SizeStr:= WizardForm.DiskSpaceLabel.Caption; 
for SymbolNumber:= 97 to 122 do begin 
while (Pos(Chr(SymbolNumber), SizeStr) > 0) do Delete(SizeStr, Pos(Chr(SymbolNumber), SizeStr),1); //Находим все символы нижнего регистра и удаляем 
while (Pos(AnsiUppercase(Chr(SymbolNumber)), SizeStr) > 0) do Delete(SizeStr, Pos(AnsiUppercase(Chr(SymbolNumber)), SizeStr),1); end;  //Находим все символы верхнего регистра и удаляем 
for SymbolNumber:= 192 to 255 do begin 
while (Pos(Chr(SymbolNumber), SizeStr) > 0) do Delete(SizeStr, Pos(Chr(SymbolNumber), SizeStr),1); end; //Находим все символы нижнего регистра и удаляем 
while (Pos('.', SizeStr) > 0) do Delete(SizeStr, Pos('.', SizeStr), 1) //Удаляем точки 
Delete(SizeStr, Pos(',', SizeStr), 5) //Удаляем дробную часть 
Result:= StrToInt(Trim(SizeStr)); //Переводим в число 
end; 
 
function CompareNum(FirstNum, SecondNum: Integer): Boolean; 
begin 
if FirstNum < SecondNum then Result:= False else Result:= True; 
end; 

#ifdef FirewallInstallHelper
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

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: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';

function enabledesc(ComponentsListHandle: HWND; DescLabelHandle: HWND; DescStrings: PChar): BOOL; external 'enabledesc@files:descctrl.dll stdcall';
function disabledesc(): BOOL; external 'disabledesc@files:descctrl.dll stdcall';

function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
  if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
  LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
  LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
  LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
  Result := ISDoneCancel;
end;

function CheckError:boolean;
begin
  result:= not ISDoneError;
end;

///////////////////////////////////////Изоображения///////////////////////////////////////////////
procedure InitializeWizard1(); 
begin 
ExtractTemporaryFile('{#FinishImage}'); 
 
WizardForm.WizardBitmapImage.Width:= ScaleX(497); 
WizardForm.WizardBitmapImage2.Width:= ScaleX(497); 
WizardForm.WizardBitmapImage2.Bitmap.LoadFromFile(ExpandConstant('{tmp}\{#FinishImage}')); 

WelcomeLabel:= TLabel.Create(WizardForm); 
WelcomeLabel.AutoSize:= False; 
with WizardForm.WelcomeLabel2 do 
WelcomeLabel.SetBounds(Left-70, Top+50, Width, Height); 
WelcomeLabel.Alignment := taCenter;
WelcomeLabel.Font:= WizardForm.WelcomeLabel2.Font 
WelcomeLabel.Font.Color:= clWhite; 
WelcomeLabel.Font.Size:=10
WelcomeLabel.Transparent:= True; 
WelcomeLabel.WordWrap:= true; 
WelcomeLabel.Caption:= ExpandConstant('{cm:WelcomeLabel}');
WelcomeLabel.Parent:= WizardForm.WelcomePage 
WelcomeLabel.Font.Style:=[fsBold];
 
FinishedLabel:= TLabel.Create(WizardForm); 
FinishedLabel.AutoSize:= False; 
with WizardForm.FinishedLabel do 
FinishedLabel.SetBounds(Left-70, Top+70, Width, Height);
FinishedLabel.Font:= WizardForm.FinishedLabel.Font 
FinishedLabel.Font.Color:= clWhite; 
FinishedLabel.Transparent:= True; 
FinishedLabel.WordWrap:= true; 
FinishedLabel.Caption:=ExpandConstant('{cm:FinishLabel}');
FinishedLabel.Parent:= WizardForm.FinishedPage 
FinishedLabel.Font.Style:=[fsBold];
FinishedLabel.Alignment := taCenter;
FinishedLabel.Font.Size:=10;
 
WizardForm.WelcomeLabel1.Hide; 
WizardForm.WelcomeLabel2.Hide; 
WizardForm.FinishedLabel.Hide; 
WizardForm.FinishedHeadingLabel.Hide; 
end; 

/////////////////////////////////

procedure InitializeWizard2(); 
begin 
WizardForm.MainPanel.Height:=150;
WizardForm.WizardSmallBitmapImage.SetBounds(ScaleX(0), ScaleY(0), WizardForm.MainPanel.Width, WizardForm.MainPanel.Height); 
 
PageNameLabel:= TLabel.Create(WizardForm) 
with WizardForm.PageNameLabel do 
PageNameLabel.SetBounds(Left, Top+50, Width, Height); 
PageNameLabel.Transparent:= True; 
PageNameLabel.Font:= WizardForm.PageNameLabel.Font; 
PageNameLabel.Font.Color:= clWhite;  //цвет надписи 
PageNameLabel.Parent:= WizardForm.MainPanel; 
 
WizardForm.PageNameLabel.Hide; 
WizardForm.PageDescriptionLabel.Hide; 

///////////////////////////////////////Изоображения///////////////////////////////////////////////

WizardForm.ComponentsList.Color:=WizardForm.SelectDirPage.Color
WizardForm.BackButton.Left:=0;
WizardForm.NextButton.Left:=WizardForm.CancelButton.Left+10;
WizardForm.NextButton.Top:=WizardForm.Bevel.Top+5;
WizardForm.NextButton.Height:=40;
WizardForm.BackButton.Top:=WizardForm.Bevel.Top+5;
WizardForm.BackButton.Height:=40;
WizardForm.SelectDirBrowseLabel.Hide;
WizardForm.CancelButton.Height:=40;
WizardForm.CancelButton.Top:=WizardForm.Bevel.Top+5;
WizardForm.CancelButton.Left:=WizardForm.CancelButton.Left+10;
WizardForm.CancelButton.Hide;
WizardForm.SelectDirBitmapImage.Hide
WizardForm.SelectGroupBitmapImage.Hide
WizardForm.SelectDirLabel.Left:=WizardForm.SelectDirBitmapImage.Left
WizardForm.SelectDirLabel.Top:=100
WizardForm.DirEdit.Top:=140
WizardForm.DirBrowseButton.Top:=140
WizardForm.GroupEdit.Top:=140
WizardForm.GroupBrowseButton.Top:=140
WizardForm.SelectComponentsLabel.Hide;
WizardForm.ComponentsDiskSpaceLabel.Hide;
WizardForm.SelectStartMenuFolderBrowseLabel.Hide;
WizardForm.SelectStartMenuFolderLabel.Left:=WizardForm.SelectDirBitmapImage.Left;
WizardForm.SelectStartMenuFolderLabel.Top:=100;
WizardForm.SelectTasksLabel.Hide;
WizardForm.ComponentsList.Top:=100;
WizardForm.ComponentsList.Height:=120;
WizardForm.TasksList.Top:=100;
WizardForm.TasksList.Height:=120;
WizardForm.StatusLabel.Top:=100;
end; 

///////////////////////////////////////Место для установки//////////////////////////////////////////////
Function MbOrTb(Byte: Extended): String;
begin
  if Byte < 1024 then Result:= NumToStr(Byte) + ' Мб' else
    if Byte/1024 < 1024 then Result:= NumToStr(round(Byte/1024*100)/100) + ' Гб' else
      Result:= NumToStr(round((Byte/(1024*1024))*100)/100) + ' Тб'
end;

procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
  Path := ExtractFileDrive(WizardForm.DirEdit.Text);
  GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
  NeedSpaceLabel.Caption := 'Игра займет на диске: '+ MbOrTb(NeedSize)
  TotalNeedSpaceLabel.Caption := 'Для установки требуется: '+ MbOrTb(TotalNeedSize)
  FreeSpaceLabel.Caption := 'Доступно места на диске: '+ MbOrTb(FreeMB)
  WizardForm.NextButton.Enabled:= (FreeMB>TotalNeedSize);
  if (FreeMB<TotalNeedSize) then
    FreeSpaceLabel.Font.Color:=clRed else
    FreeSpaceLabel.Font.Color:=WizardForm.Font.Color;
end;

procedure SpaceLabel();
begin
  NeedSize := {#NeedSize};
  TotalNeedSize := {#TotalNeedSize};

  FreeSpaceLabel := TLabel.Create(WizardForm);
  FreeSpaceLabel.Parent := WizardForm.SelectDirPage;
  FreeSpaceLabel.SetBounds(ScaleX(0), ScaleY(180), ScaleX(209), ScaleY(13));

  TotalNeedSpaceLabel := TLabel.Create(WizardForm);
  TotalNeedSpaceLabel.Parent := WizardForm.SelectDirPage;
  TotalNeedSpaceLabel.SetBounds(ScaleX(0), ScaleY(200), ScaleX(209), ScaleY(13));

  NeedSpaceLabel := TLabel.Create(WizardForm);
  NeedSpaceLabel.Parent := WizardForm.SelectDirPage;
  NeedSpaceLabel.SetBounds(ScaleX(0), ScaleY(220), ScaleX(209), ScaleY(13));

  WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
  
  WizardForm.DiskSpaceLabel.Hide;
end;
///////////////////////////////////////Место для установки//////////////////////////////////////////////

///////////////////////////////////////ISDone////////////////////////
procedure CancelButtonOnClick(Sender: TObject);
begin
  SuspendProc;
  if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
  ResumeProc;
end;

procedure HideControls;
begin
  WizardForm.FileNamelabel.Hide;
  ISDoneProgressBar1.Hide;
  LabelPct1.Hide;
  LabelTime1.Hide;
  LabelTime2.Hide;
  MyCancelButton.Hide;
end;

procedure CreateControls;
var PBTop:integer;
begin
  PBTop:=ScaleY(50);
  ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
  with ISDoneProgressBar1 do begin
    Parent   := WizardForm;
    Height   := WizardForm.CancelButton.Height-10
    Left     := ScaleX(0);
    Top      := WizardForm.BackButton.Top+5;
    Width    := ScaleX(405);
    Max      := 1000;
  end;
  LabelPct1 := TLabel.Create(WizardForm);
  with LabelPct1 do begin
    Parent    := ISDoneProgressBar1;
    AutoSize  := True;
    Left      := 10;
    Top       := 3;
    Font.Size := 14;
    Width     := ScaleX(80);
    Transparent:=True;
  end;
  LabelTime1 := TLabel.Create(WizardForm);
  with LabelTime1 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := ISDoneProgressBar1.Width div 2;
    Left     := ScaleX(0);
    Top      := 200;
  end;
  LabelTime2 := TLabel.Create(WizardForm);
  with LabelTime2 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := LabelTime1.Width+ScaleX(40);
    Left     := ISDoneProgressBar1.Width div 2;
    Top      := LabelTime1.Top;
  end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
var Comps1,Comps2,Comps3, TmpValue:cardinal;
    FindHandle1,ColFiles1,CurIndex1,tmp:integer;
    ExecError:boolean;
    InFilePath,OutFilePath,OutFileName:PAnsiChar;
begin
  if CurStep = ssInstall then begin  //Если необходимо, можно поменять на ssPostInstall
    WizardForm.ProgressGauge.Hide;
    WizardForm.CancelButton.Hide;
    CreateControls;
    WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
    ISDoneCancel:=0;

// Распаковка всех необходимых файлов в папку {tmp}.

ExtractTemporaryFile('unarc.dll');

#ifdef PrecompInside
ExtractTemporaryFile('CLS-precomp.dll');
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('packjpg_dll1.dll');
ExtractTemporaryFile('precomp.exe');
ExtractTemporaryFile('zlib1.dll');
#endif
#ifdef SrepInside
ExtractTemporaryFile('CLS-srep.dll');
#endif
#ifdef MSCInside
ExtractTemporaryFile('CLS-MSC.dll');
#endif
#ifdef facompress
    ExtractTemporaryFile('facompress.dll'); //ускоряет распаковку .arc архивов.
#endif
#ifdef records
    ExtractTemporaryFile('records.inf');
#endif
#ifdef precomp
  #if precomp == "0.38"
    ExtractTemporaryFile('precomp038.exe');
  #else
    #if precomp == "0.4"
      ExtractTemporaryFile('precomp040.exe');
    #else
      #if precomp == "0.41"
        ExtractTemporaryFile('precomp041.exe');
      #else
        #if precomp == "0.42"
          ExtractTemporaryFile('precomp042.exe');
        #else
          ExtractTemporaryFile('precomp038.exe');
          ExtractTemporaryFile('precomp040.exe');
          ExtractTemporaryFile('precomp041.exe');
          ExtractTemporaryFile('precomp042.exe');
        #endif
      #endif
    #endif
  #endif
#endif
#ifdef unrar
    ExtractTemporaryFile('Unrar.dll');
#endif
#ifdef XDelta
    ExtractTemporaryFile('XDelta3.dll');
#endif
#ifdef PackZIP
    ExtractTemporaryFile('7z.dll');
    ExtractTemporaryFile('PackZIP.exe');
#endif

    ExtractTemporaryFile('English.ini');

// Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll
// максимум 96 компонентов.
    Comps1:=0; Comps2:=0; Comps3:=0;
#ifdef Components
    TmpValue:=1;
    if IsComponentSelected('text\rus') then Comps1:=Comps1+TmpValue;     //компонент 1
    TmpValue:=TmpValue*2;
    if IsComponentSelected('text\eng') then Comps1:=Comps1+TmpValue;     //компонент 2
    TmpValue:=TmpValue*2;
    if IsComponentSelected('sound\rus') then Comps1:=Comps1+TmpValue;    //компонент 3
    TmpValue:=TmpValue*2;
    if IsComponentSelected('sound\eng') then Comps1:=Comps1+TmpValue;    //компонент 4
//    .....
// см. справку
#endif

#ifdef precomp
  PCFVer:={#precomp};
#else
  PCFVer:=0;
#endif
    ISDoneError:=true;
    if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, MainForm.Handle, {#NeedMem}, @ProgressCallback) then begin
      repeat
//        ChangeLanguage('English');
        if not SrepInit('',512,0) then break;
        if not PrecompInit('',128,PCFVer) then break;
        if not FileSearchInit(true) then break;

        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\GameData.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        if not ISArcExtract ( 1, 0, ExpandConstant('{src}\TextRus.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        if not ISArcExtract ( 2, 0, ExpandConstant('{src}\TextEng.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        if not ISArcExtract ( 3, 0, ExpandConstant('{src}\SoundRus.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        if not ISArcExtract ( 4, 0, ExpandConstant('{src}\SoundEng.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

//    далее находятся закомментированые примеры различных функций распаковки (чтобы каждый раз не лазить в справку за примерами)
(*
        if not ISArcExtract    ( 0, 0, ExpandConstant('{src}\arc.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        if not IS7ZipExtract   ( 0, 0, ExpandConstant('{src}\CODMW2.7z'), ExpandConstant('{app}\data1'), false, '') then break;
        if not ISRarExtract    ( 0, 0, ExpandConstant('{src}\data_*.rar'), ExpandConstant('{app}'), false, '') then break;
        if not ISSRepExtract   ( 0, 0, ExpandConstant('{app}\data1024_1024.srep'),ExpandConstant('{app}\data1024.arc'), true) then break;
        if not ISPrecompExtract( 0, 0, ExpandConstant('{app}\data.pcf'),    ExpandConstant('{app}\data.7z'), true) then break;
        if not ISxDeltaExtract ( 0, 0, 0, 640, ExpandConstant('{app}\in.pcf'), ExpandConstant('{app}\*.diff'),   ExpandConstant('{app}\out.dat'), false) then break;
        if not ISPackZIP       ( 0, 0, ExpandConstant('{app}\1a1\*'), ExpandConstant('{app}\1a1.pak'), 2, false ) then break;
        if not ISExec          ( 0, 0, 0, ExpandConstant('{tmp}\Arc.exe'), ExpandConstant('x -o+ "{src}\001.arc" "{app}\"'), ExpandConstant('{tmp}'), '...',false) then break;
        if not ShowChangeDiskWindow ('Пожалуйста, вставьте второй диск и дождитесь его инициализации.', ExpandConstant('{src}'),'CODMW_2.arc') then break;

//    распаковка группы файлов посредством внешнего приложения

        FindHandle1:=ISFindFiles(0,ExpandConstant('{app}\*.ogg'),ColFiles1);
        ExecError:=false;
        while not ExecError and ISPickFilename(FindHandle1,ExpandConstant('{app}\'),CurIndex1,true) do begin
          InFilePath:=ISGetName(0);
          OutFilePath:=ISGetName(1);
          OutFileName:=ISGetName(2);
          ExecError:=not ISExec(0, 0, 0, ExpandConstant('{tmp}\oggdec.exe'), '"'+InFilePath+'" -w "'+OutFilePath+'"',ExpandConstant('{tmp}'),OutFileName,false);
        end;
        ISFindFree(FindHandle1);
        if ExecError then break;
*)

        ISDoneError:=false;
      until true;
      ISDoneStop;
    end;
    HideControls;
    WizardForm.CancelButton.Visible:=true;
    WizardForm.CancelButton.Enabled:=false;
    BtnPanel.Show;
  end;
  if (CurStep=ssPostInstall) and ISDoneError then begin
    Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
  end;
end;
/////////////////////////////////////////////ISDone/////////////////////

/////////////////Is Win7//////////////////////////////////
procedure iswin7_add_glass(Handle:HWND; Left, Top, Right, Bottom : Integer; GDIPLoadMode: boolean);
external 'iswin7_add_glass@files:iswin7.dll stdcall';

procedure iswin7_add_button(Handle:HWND);
external 'iswin7_add_button@files:iswin7.dll stdcall';

procedure iswin7_free;
external 'iswin7_free@files:iswin7.dll stdcall';
/////////////////Is Win7//////////////////////////////

////////////////////////////////Лого///////////////////////////
procedure TestButtonOnClick(Sender: TObject);
begin
  MsgBox('RePack by Dr.DLL' + #10#13 + '- Ничего не вырезано/перекодировано' + #10#13 + '- Вшит Update 1'+ #10#13 + '- Вшита таблетка', mbInformation, MB_OK)
end;

procedure InitializeWizard3();  
begin
  BtnPanel:=TPanel.Create(WizardForm)
  with BtnPanel do begin
    Left:=180
    Top:=320
    Width:=132
    Height:=35
    Cursor:=crHand
    OnClick:=@TestButtonOnClick
    Parent:=WizardForm
  end
  BtnImage:=TBitmapImage.Create(WizardForm)
  with BtnImage do begin
    AutoSize:=True
    Enabled:=False
    ExtractTemporaryFile('Logo.bmp')
    Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\Logo.bmp')
    Parent:=BtnPanel
  end
end;
/////////////////////////////////Лого///////////////////////////////////////

/////////////////////////////////Описание компонентов//////////////////////////
  #ifdef ComponentsInfo
procedure InitializeWizard4();
begin
  WizardForm.TYPESCOMBO.Visible:= false;

  InfoPanel := TPanel.Create(WizardForm);
  InfoPanel.Parent := WizardForm.SelectComponentsPage;
  InfoPanel.Caption := '';
  InfoPanel.Top := WizardForm.ComponentsList.Top;
  InfoPanel.Left := ScaleX(216);
  InfoPanel.Width := ScaleX(201);
  InfoPanel.Height := WizardForm.ComponentsList.Height;
  InfoPanel.BevelInner := bvRaised;
  InfoPanel.BevelOuter := bvLowered;
  InfoCaption := TNewStaticText.Create(WizardForm);
  InfoCaption.Parent := WizardForm.SelectComponentsPage;
  InfoCaption.Caption := 'Информация:';
  InfoCaption.Left := ScaleX(224);
  InfoCaption.Top := InfoPanel.Top - ScaleY(5);
  InfoCaption.Font.Color := clBlack;//clActiveCaption;
  Info := TNewStaticText.Create(WizardForm);
  Info.Parent := InfoPanel;
  Info.Font.Color:=clBlack;
  Info.AutoSize := False;
  Info.Left := ScaleX(6);
  Info.Width := ScaleX(188);
  Info.Top := ScaleY(12);
  Info.Height := WizardForm.ComponentsList.Height - ScaleY(17);
  Info.Caption := 'Наведите на компонент, чтобы получить дополнительную информацию';
  Info.WordWrap := true;
  enabledesc(WizardForm.ComponentsList.Handle,Info.Handle,
       'Язык текста в игре (меню, субтитры);'+
       'Русский текст;'+
       'Английский текст;'+
       'Язык озвучки в игре (диалоги);'+
       'Русская озвучка;'+
       'Английская озвучка;'
       
       );
end;
#endif
/////////////////////////////////Описание компонентов//////////////////////////

//////////////////////////// Удаление сохранений ///////////////////////////
procedure DeleteSavedGames(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep=usUninstall then
  if DirExists(ExpandConstant('{userdocs}')+'\My Games\Skyrim') then
  if MsgBox(ExpandConstant('{cm:DeleteSave}'), mbInformation, MB_YESNO) = idYes then
  DelTree(ExpandConstant('{userdocs}')+'\My Games\Skyrim', True, True, True)
end;
//////////////////////////// Удаление сохранений ///////////////////////////
procedure InitializeWizard();
begin
    MyCancelButton:=TNewButton.Create(WizardForm);
    with MyCancelButton do begin
    Parent:=WizardForm;
    Width:=WizardForm.CancelButton.Width;
    Caption:='Отмена';
    Left:=WizardForm.CancelButton.Left+10;
    Height:=40;
    Top:=WizardForm.Bevel.Top+5;    
    OnClick:=@CancelButtonOnClick;
  // Необходимо добавлять каждую кнопку расположенную на стекле
  // до инициализации стекла для того что бы не было дыр ))
  iswin7_add_button(WizardForm.BackButton.Handle);
  iswin7_add_button(WizardForm.NextButton.Handle);
  iswin7_add_button(WizardForm.CancelButton.Handle);
  iswin7_add_button(MyCancelButton.Handle);
  // Параметр True не трогать он для htuos ))
  iswin7_add_glass(WizardForm.Handle, 0, 0, 0, 47, True);
end;
  InitializeWizard1();
  InitializeWizard2(); 
  InitializeWizard3();
  #ifdef ComponentsInfo
  InitializeWizard4();
  #endif
  SpaceLabel;
end;

Procedure CurPageChanged(CurPageID: Integer);
Begin
#ifdef CancelOnWelcome
 if CurPageID = wpWelcome then
 begin
  WizardForm.CancelButton.Left:=0;
end;
 if CurPageID = wpsELECTdIR then
 begin
  WizardForm.CancelButton.Left:=WizardForm.NextButton.Left;
end;
#endif
 if CurPageID = wpSelectTasks then
 begin
  WizardForm.NextButton.Caption:='Установить';
end;
 if CurPageID = wpInstalling then
 begin
  BtnPanel.Hide;
end;
  MyCancelButton.Hide;
if CurPageID = wpInstalling then
 begin
  MyCancelButton.Show;
end;

  PageNameLabel.Caption:= WizardForm.PageNameLabel.Caption; 
  if CurPageID = wpSelectDir then GetFreeSpaceCaption(nil);
  if (CurPageID = wpFinished) and ISDoneError then
  begin
    WizardForm.Caption:= ExpandConstant('{cm:Error}');
    FinishedLabel.Font.Color:= clRed;
    FinishedLabel.Caption:= ExpandConstant('{cm:FinishedLabel}');
  end;
end;

procedure DeinitializeSetup();
begin
  iswin7_free;
  #ifdef ComponentsInfo
  disabledesc();
  #endif
end;

procedure InitializeUninstallProgressForm;
begin
   UninstallProgressForm.CancelButton.Hide;
   UninstallProgressForm.Bevel.Hide;
   UninstallProgressForm.Bevel1.Hide;
   UninstallProgressForm.ClientHeight := 100;
   UninstallProgressForm.Position:=poScreenCenter
   UninstallProgressForm.MainPanel.Hide;
   UninstallProgressForm.InnerNotebook.Top:=0
   UninstallProgressForm.InnerNotebook.Left:=0
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); 
var 
path: String; 
begin 
DeleteSavedGames(CurUninstallStep);
if CurUninstallStep=usUninstall then 
begin 
path:=ExpandConstant('{#path}'); 
RemoveApplicationFromExceptionList(path)
UnloadDll(ExpandConstant('{app}\FirewallInstallHelper.dll')); 
end; 
end;
 
Последнее редактирование:

vint56

Ветеран
Проверенный
MAKS_MAFIA
добавь
#define path "{app}\MyProg.exe"
 
Последнее редактирование:

Shegorat

Lord of Madness
Администратор
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
path: String;
begin
DeleteSavedGames(CurUninstallStep);
if CurUninstallStep=usUninstall then
begin
path:=ExpandConstant('{#path}');
RemoveApplicationFromExceptionList(path)
UnloadDll(ExpandConstant('{app}\FirewallInstallHelper.dll'));
end;
end;
Константы {#path} нет, либо она не задекларирована, о чем собственно и говорится в сообщении. Думаю там должно быть что-то типа
Код:
path:= ExpandConstant('{app}\MyExe.exe');
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху