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

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

sergey3695

Ветеран
Модератор
Mailchik, для ярлыка то я сделал,а вот с папкой загвоздка. как я понял чтобы создать папку в несуществующей директории с помощью CreateShellLink (создает только ярлыки), надо её создать. как правильно это сделать? и что написать,чтобы потом удалялся ярлык и папка в меню пуск при деинсталляции? (с помощью DelTree или RemoveDir - удалять и папку можно с помощью CreateDir создать? просто как-то с данными функциями особо не работал, поэтому спрашиваю)
 

Mailchik

Старожил
Проверенный
как я понял чтобы создать папку в несуществующей директории с помощью CreateShellLink (создает только ярлыки), надо её создать. как правильно это сделать?
Лучше использовать ForceDirectories, так как CreateDir не создаст папку в несуществующей папке, а вот ForceDirectories создаст всё древо папок указанного в пути.
Код:
ForceDirectories(ExpandConstant('{src}\test\test2\test3'));
[HR][/HR]
и что написать,чтобы потом удалялся ярлык и папка в меню пуск при деинсталляции?
Здесь также лучше использовать DelTree, так как RemoveDir удаляет только пустую папку. Ну а ярлык это простой файл, значит функция DeleteFile вполне подойдет.
Код:
DelTree(ExpandConstant('{src}\test'), True, True, True);
DeleteFile(ExpandConstant('{src}\Test_dir.lnk'));
 

LexBell

Борода
Супер модератор
Здесь также лучше использовать DelTree, так как RemoveDir удаляет только пустую папку.
На соседнем форуме товарищ Rymski пользуется такой конструкцией:

[SOURCE="iss"]procedure DelDir(dir : string); // Удаление папки со всем содержимым
var
r: Integer;
begin
Exec('cmd.exe', ' /c rd /S /Q ' + '"'+dir+'"',ExpandConstant('{sys}'), SW_Hide,ewWaitUntilTerminated,r);
end;

procedure DelFle(fle : string); //Удаление файла
var
r: Integer;
begin
Exec('cmd.exe', ' /c del /F /Q ' + '"'+fle+'"',ExpandConstant('{sys}'), SW_Hide,ewWaitUntilTerminated,r);
end;[/SOURCE]
DelDir удаляет даже там, где DelTree не может удалить. Собственно при неудачном опыте по невнимательности я удалил папку Users :)
 

sergey3695

Ветеран
Модератор
Решил спросить все-таки. А можно ли как-нибудь сделать поиск ярлыка на рабочем столе который прикреплен к определенному объекту? звучит конечно нереально, но может есть выход? :unknown:
 

LexBell

Борода
Супер модератор
sergey3695, можно. вот только в инно это дело портировать - мутно долго и неблагодарно. можешь попробовать длл-ку сделать.
 

GolD20

Новичок
Здравствуйте. Хочу прикрутить скрипт проверки свободного места на диске.

var
NeedSize:Integer;
FreeMB, TotalMB: Cardinal;
NeedSpaceLabel: TLabel;
n: Integer;
VolumeName, FileSystemName: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;
StartMenuTreeView: TStartMenuFolderTreeView;

procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True; end;

procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := 'Требуется как минимум '+ FloatToStr(round(NeedSize/1024*100)/100) + ' Гб свободного дискового пространства.' else
NeedSpaceLabel.Caption := 'Требуется как минимум '+ IntToStr(NeedSize)+ ' Мб свободного дискового пространства.';end;

const oneMB= 1024*1024;
function GetLogicalDrives: DWord; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(nDrive: String): Longint; external 'GetDriveTypeA@kernel32.dll stdcall';
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; external 'MessageBoxA@user32.dll stdcall';

Function ByteOrTB(Bytes: Extended; noMB: Boolean): String; { Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)}
Begin
if not noMB then Result:= FloatToStr(Int(Bytes)) +' Мб' else
if Bytes < 1024 then Result:= FloatToStr(Int(Bytes)) +' Бт' else
if Bytes/1024 < 1024 then Result:= FloatToStr(round((Bytes/1024)*10)/10) +' Кб' else
If Bytes/oneMB < 1024 then Result:= FloatToStr(round(Bytes/oneMB*100)/100) +' Мб' else
If Bytes/oneMB/1000 < 1024 then Result:= FloatToStr(round(Bytes/oneMB/1024*1000)/1000) +' Гб' else
Result:= FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Тб'
StringChange(Result, ',', '.')
End;

Function DelSP(String: String): String; { Удаление начальных, конечных и повторных пробелов }
Begin while (Pos(' ', String) > 0) do Delete(String, Pos(' ', String), 1); Result:= Trim(String); End;

Function CutString(String: String; MaxLength: Longint): String; { Обрезать строку до заданного кол-ва символов}
Begin
if Length(String) > MaxLength then Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength)
else Result:= String;
End;

Procedure GetDiskInfo(Disk: String);
Begin
FileSystemName:= StringOfChar(' ', 32); VolumeName:= StringOfChar(' ', 256);
GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31);
FileSystemName:= DelSp(FileSystemName); VolumeName:= DelSp(VolumeName); if VolumeName='' then VolumeName:='без метки';
End;

Procedure ListBoxRefresh; var FreeB, TotalB: Cardinal; Path, String: string; Begin
ListBox.Items.Clear
for n:= 1 to 31 do // диск 'А' пропустить
if (GetLogicalDrives and (1 shl n)) > 0 then
if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then
if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then ListBox.Items.Add(Chr(ord('A') + n) +':');
for n:= 0 to ListBox.Items.Count -1 do begin
Path:= Copy(ListBox.Items[n],1,2) +'\' { если в накопителе нет диска, пропустить обновление }
if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then begin GetDiskInfo(Path);
if FreeB >= $7FFFFFFF then String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else String:= PadL(ByteOrTB(FreeB, true),10);
if TotalB >= $7FFFFFFF then begin TotalB:= TotalMB; FreeB:= FreeMB; String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего -'+ String end else String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String;
ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9); end; end;
End;

Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text))
StartMenuTreeView: if StartMenuTreeView.Directory <> '' then WizardForm.GroupEdit.Text:= StartMenuTreeView.Directory else WizardForm.GroupEdit.Text:= '{#SetupSetting("DefaultGroupName")}'
WizardForm.NoIconsCheck: begin WizardForm.GroupEdit.Enabled:= not(WizardForm.GroupEdit.Enabled); StartMenuTreeView.Enabled:= WizardForm.GroupEdit.Enabled; WizardForm.GroupBrowseButton.Enabled:= WizardForm.GroupEdit.Enabled end;
end; End;

procedure InitializeWizard();
begin
NeedSize := 6100; //Здесь указывается место для приложения
WizardForm.DiskSpaceLabel.Hide;
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(220);
Width := ScaleX(209);
Height := ScaleY(13);
end;
ListBox:= TListBox.Create(WizardForm)
ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12))
ListBox.Font.Size:= 9
ListBox.Font.Style:= []
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID=wpSelectDir then
begin
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False
ListBoxRefresh
end;
end;

Его надо вставлять в Modules\InitializeWizard.iss? Или в сам скрипт? Если в главный скрипт то пишет ошибку Uknown type PChar. Изменил на PAnsiChar. Теперь подсвечивает ошибку в этой строке
StringChange(Result, ',', '.')
Код:
 #include "modules\InitializeWizard.iss"

const
  PCFonFLY=true;
  notPCFonFLY=false;
var
  LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2,LabelTime3: TLabel;
  ISDoneProgressBar1: TNewProgressBar;
#ifdef SecondProgressBar
  LabelPct2: TLabel;
  ISDoneProgressBar2:TNewProgressBar;
#endif
  MyCancelButton: TButton;
  ISDoneCancel:integer;
  ISDoneError:boolean;
  PCFVer:double;

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';
   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)+'%';
#ifdef SecondProgressBar
  if CurrentPct<=1000 then ISDoneProgressBar2.Position := CurrentPct;
  LabelPct2.Caption := IntToStr(CurrentPct div 10)+'.'+chr(48 + CurrentPct mod 10)+'%';
#endif
  LabelCurrFileName.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));
  LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
  LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
  LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
  Result := ISDoneCancel;
end;
//Меняем кнопку "далее" на "установить"
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;
  LabelCurrFileName.Hide;
  LabelTime1.Hide;
  LabelTime2.Hide;
  MyCancelButton.Hide;
#ifdef SecondProgressBar
  ISDoneProgressBar2.Hide;
  LabelPct2.Hide;
#endif
end;
 procedure CreateControls;
var PBTop:integer;
begin
  PBTop:=ScaleY(50);
  ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
  with ISDoneProgressBar1 do begin
    Parent   := WizardForm.InstallingPage;
    Height   := WizardForm.ProgressGauge.Height;
    Left     := ScaleX(0);
    Top      := PBTop;
    Width    := ScaleX(365);
    Max      := 1000;
  end;
  LabelPct1 := TLabel.Create(WizardForm);
  with LabelPct1 do begin
    Parent    := WizardForm.InstallingPage;
    AutoSize  := False;
    Left      := ISDoneProgressBar1.Width+ScaleX(5);
    Top       := ISDoneProgressBar1.Top + ScaleY(2);
    Width     := ScaleX(80);
  end;
  LabelCurrFileName := TLabel.Create(WizardForm);
  with LabelCurrFileName do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := ISDoneProgressBar1.Width+ScaleX(30);
    Left     := ScaleX(0);
    Top      := ScaleY(30);
  end;
#ifdef SecondProgressBar
  PBTop:=PBTop+ScaleY(25);
  ISDoneProgressBar2 := TNewProgressBar.Create(WizardForm);
  with ISDoneProgressBar2 do begin
    Parent   := WizardForm.InstallingPage;
    Left     := ScaleX(0);
    Top      := PBTop+ScaleY(8);
    Width    := ISDoneProgressBar1.Width;
    Max      := 1000;
    Height   := WizardForm.ProgressGauge.Height;
  end;
  LabelPct2 := TLabel.Create(WizardForm);
  with LabelPct2 do begin
    Parent    := WizardForm.InstallingPage;
    AutoSize  := False;
    Left      := ISDoneProgressBar2.Width+ScaleX(5);
    Top       := ISDoneProgressBar2.Top + ScaleY(2);
    Width     := ScaleX(80);
  end;
#endif
  LabelTime1 := TLabel.Create(WizardForm);
  with LabelTime1 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := ISDoneProgressBar1.Width div 2;
    Left     := ScaleX(0);
    Top      := PBTop + ScaleY(35);
  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;
  LabelTime3 := TLabel.Create(WizardForm);
  with LabelTime3 do begin
    Parent   := WizardForm.FinishedPage;
    AutoSize := False;
    Width    := 300;
    Left     := 180;
    Top      := 200;
  end;
  MyCancelButton:=TButton.Create(WizardForm);
  with MyCancelButton do begin
    Parent:=WizardForm;
    Width:=ScaleX(135);
    Caption:=ExpandConstant('{cm:CancelButton}');
    Left:=ScaleX(360);
    Top:=WizardForm.cancelbutton.top;
    OnClick:=@CancelButtonOnClick;
  end;
end;
 
Procedure CurPageChanged(CurPageID: Integer);
////заменяем "далее" на "установить"
Begin
  case CurPageID of
  wpSelectTasks:
  begin
    WizardForm.NextButton.Caption := ExpandConstant(SetupMessage(msgButtonInstall));
  end;
  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;
function CheckError:boolean;
begin
  result:= not ISDoneError;
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('voice\rus') then Comps1:=Comps1+TmpValue;    //компонент 3
    TmpValue:=TmpValue*2;
    if IsComponentSelected('voice\eng') then Comps1:=Comps1+TmpValue;    //компонент 4
//    .....
// см. справку
#endif

#ifdef precomp
  PCFVer:={#precomp};
#else
  PCFVer:=0;
#endif
    ISDoneError:=true;
    if ISDoneInit(ExpandConstant('{src}\records.inf'), $7777, 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}\*.ptg'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

        (*if not ISArcExtract ( , 0, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        if not ISArcExtract ( , 0, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        if not ISArcExtract ( , 0, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        if not ISArcExtract ( , 0, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        if not ISArcExtract ( , 0, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        if not ISArcExtract ( , 0, ExpandConstant('{src}\*.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, 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;
  end;
  if (CurStep=ssPostInstall) and ISDoneError then begin
    Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
  end;
end;


var
  NeedSize:Integer;
  FreeMB, TotalMB: Cardinal;
  NeedSpaceLabel: TLabel;
  n: Integer;
  VolumeName, FileSystemName: String;
  VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
  ListBox: TListBox;
  StartMenuTreeView: TStartMenuFolderTreeView;

procedure GetFreeSpaceCaption(Sender: TObject);
var
  Path: String;
begin
  Path := ExtractFileDrive(WizardForm.DirEdit.Text);
  GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
  if FreeMB < NeedSize then
  WizardForm.NextButton.Enabled := False else
  WizardForm.NextButton.Enabled := True; end;

procedure GetNeedSpaceCaption;
begin
  if NeedSize > 1024 then
  NeedSpaceLabel.Caption := 'Требуется как минимум '+ FloatToStr(round(NeedSize/1024*100)/100) + ' Гб свободного дискового пространства.' else
  NeedSpaceLabel.Caption := 'Требуется как минимум '+ IntToStr(NeedSize)+ ' Мб свободного дискового пространства.';end;

const oneMB= 1024*1024;
function GetLogicalDrives: DWord; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(nDrive: String): Longint; external 'GetDriveTypeA@kernel32.dll stdcall';
function GetVolumeInformation(PathName,VolumeName: PAnsiChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PAnsiChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; external 'MessageBoxA@user32.dll stdcall';

Function ByteOrTB(Bytes: Extended; noMB: Boolean): String; { Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)}
Begin
if not noMB then Result:= FloatToStr(Int(Bytes)) +' Мб' else
if Bytes < 1024 then Result:= FloatToStr(Int(Bytes)) +' Бт' else
if Bytes/1024 < 1024 then Result:= FloatToStr(round((Bytes/1024)*10)/10) +' Кб' else
If Bytes/oneMB < 1024 then Result:= FloatToStr(round(Bytes/oneMB*100)/100) +' Мб' else
If Bytes/oneMB/1000 < 1024 then Result:= FloatToStr(round(Bytes/oneMB/1024*1000)/1000) +' Гб' else
Result:= FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Тб'
StringChange(Result, ',', '.')
End;

Function DelSP(String: String): String; { Удаление начальных, конечных и повторных пробелов }
Begin while (Pos(' ', String) > 0) do Delete(String, Pos(' ', String), 1); Result:= Trim(String); End;

Function CutString(String: String; MaxLength: Longint): String; { Обрезать строку до заданного кол-ва символов}
Begin
if Length(String) > MaxLength then Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength)
else Result:= String;
End;

Procedure GetDiskInfo(Disk: String);
Begin
FileSystemName:= StringOfChar(' ', 32); VolumeName:= StringOfChar(' ', 256);
GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31);
FileSystemName:= DelSp(FileSystemName); VolumeName:= DelSp(VolumeName); if VolumeName='' then VolumeName:='без метки';
End;

Procedure ListBoxRefresh; var FreeB, TotalB: Cardinal; Path, String: string; Begin
ListBox.Items.Clear
for n:= 1 to 31 do // диск 'А' пропустить
if (GetLogicalDrives and (1 shl n)) > 0 then
if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then
if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then ListBox.Items.Add(Chr(ord('A') + n) +':');
for n:= 0 to ListBox.Items.Count -1 do begin
Path:= Copy(ListBox.Items[n],1,2) +'\' { если в накопителе нет диска, пропустить обновление }
if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then begin GetDiskInfo(Path);
if FreeB >= $7FFFFFFF then String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else String:= PadL(ByteOrTB(FreeB, true),10);
if TotalB >= $7FFFFFFF then begin TotalB:= TotalMB; FreeB:= FreeMB; String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего -'+ String end else String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String;
ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9); end; end;
End;

Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text))
StartMenuTreeView: if StartMenuTreeView.Directory <> '' then WizardForm.GroupEdit.Text:= StartMenuTreeView.Directory else WizardForm.GroupEdit.Text:= '{#SetupSetting("DefaultGroupName")}'
WizardForm.NoIconsCheck: begin WizardForm.GroupEdit.Enabled:= not(WizardForm.GroupEdit.Enabled); StartMenuTreeView.Enabled:= WizardForm.GroupEdit.Enabled; WizardForm.GroupBrowseButton.Enabled:= WizardForm.GroupEdit.Enabled end;
end; End;

procedure InitializeWizard();
begin
  NeedSize := 6100;                  //Здесь указывается место для приложения
  WizardForm.DiskSpaceLabel.Hide;
  NeedSpaceLabel := TLabel.Create(WizardForm);
  with NeedSpaceLabel do
  begin
  Parent := WizardForm.SelectDirPage;
  Left := ScaleX(0);
  Top := ScaleY(220);
  Width := ScaleX(209);
  Height := ScaleY(13);
  end;
  ListBox:= TListBox.Create(WizardForm)
  ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12))
  ListBox.Font.Size:= 9
  ListBox.Font.Style:= []
  ListBox.Font.Name:= 'Courier New';
  ListBox.OnClick:= @ObjectOnClick;
  ListBox.Parent:= WizardForm.SelectDirPage;
  WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
  WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
  end;

procedure CurPageChanged(CurPageID: Integer);
  begin
  if CurPageID=wpSelectDir then
  begin
  GetNeedSpaceCaption;
  if FreeMB < NeedSize then
  WizardForm.NextButton.Enabled:=False
  ListBoxRefresh
  end;
  end;[/SPOILER]

Не влезет текст проверки свободного места? Скрин.
 

Вложения

Последнее редактирование:

Mailchik

Старожил
Проверенный
Его надо вставлять в Modules\InitializeWizard.iss? Или в сам скрипт? Если в главный скрипт то пишет ошибку Uknown type PChar. Изменил на PAnsiChar. Теперь подсвечивает ошибку в этой строке StringChange(Result, ',', '.')
Пропущена точка с запятой перед этой строкой.
Должно быть так:
Код:
Result:= FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Тб';
StringChange(Result, ',', '.');
 

Mailchik

Старожил
Проверенный
Бахытжан, хороший вопрос, и код понятный и скрипт тоже, всё видно по нему..
но всё же попытаюсь ответить: удалите из скрипта всё что связано с LabelPct1.
Mickey1s, можно - запускаете cmd.exe с ключами для удаления нужной папки.
Код:
ISExec(0, 0, 0, 'cmd.exe',  '/c rd /S /Q  ' + '"C:\Test"', ExpandConstant('{sys}'), 'Удаление папки...', False);
C:\Test - Удаляемая папка.
 

ProZorg

Новичок
Здравствуйте! Есть ли у кого нибудь пример осуществления такой функции: По нажатию на кнопку размер формы увеличивался бы в одну из сторон (например низ формы), и на ней бы отображались бы нужные компоненты, и если снова нажать на кнопку, форма бы задвигалась бы в исходный размер. Заранее благодарю
 

vint56

Ветеран
Проверенный
ProZorg
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[Types]
Name: full; Description: Full installation; Flags: iscustom

[Components]
Name: text; Description: Дополнительное по; Types: full;
Name: text\DirectX; Description: DirectX 9;
Name: text\Visual; Description: Microsoft Visual C++;

Код:
var
Flag: Boolean;
 SettingButton: TButton;
procedure HideShowOnClick(Sender: TObject);
begin
  if Flag = False then begin
  WizardForm.ClientWidth:= ScaleX(497);
  WizardForm.ClientHeight:= ScaleY(360);
  Flag:= True;
  SettingButton.Caption:= '[]';
end else begin
  WizardForm.ClientWidth:= ScaleX(497);
  WizardForm.ClientHeight:= ScaleY(450);
  Flag:= False;
  SettingButton.Caption:= '[]';
end;
end;

procedure InitializeWizard();
begin
  SettingButton:= TButton.Create(WizardForm);
  SettingButton.SetBounds(ScaleX(10),ScaleY(325), ScaleX(30), ScaleY(30))
  SettingButton.Caption:= '[]';
  SettingButton.OnClick:= @HideShowOnClick;
  SettingButton.Parent:= WizardForm;
  Flag:=True;
  with WizardForm do  begin
  ComponentsList.Parent:= WizardForm;
  WizardForm.ComponentsList.Checked[1]:=True
  WizardForm.ComponentsList.Checked[2]:=True
  WizardForm.ComponentsList.Top := ScaleY(370);
  WizardForm.ComponentsList.Height := ScaleY(55);
  WizardForm.ComponentsList.Left := ScaleY(40);
  WizardForm.ComponentsList.Color := clMenu;
 end;
end;[/SPOILER]
 

Mailchik

Старожил
Проверенный
vint56, ProZorg, пример с таймером (плавное появление):
 

OneTwo

Новичок
Проверенный
Есть ли у кого-нибудь пример текстурирования радиобуттонов и чекбоксов, без сторонних библиотек (botva и т.д.) и использования скинов? Хотя бы чекбоксов?
 

makst

Новичок
Привет всем. Хотел взглянуть на вот этот скрипт - http://krinkels.org/downloads.php?do=file&id=92

... Но при компиляций выделяется это строка
Код:
procedure IsWin7LogoInit(File: PChar; X, Y: Integer; L, R, T, B: Integer; Handle: HWND); external 'iswin7_6594@files:logo.dll stdcall';
и пишет "Unknown type PChar"

Что же это может быть?
 

vint56

Ветеран
Проверенный
kkels
ошибку "Unknown type : 'PChar
type
PChar = PAnsiChar; //добавиш это
там еще будут ошибки end добавиш;
 

Mailchik

Старожил
Проверенный
Есть ли у кого-нибудь пример текстурирования радиобуттонов и чекбоксов, без сторонних библиотек (botva и т.д.) и использования скинов? Хотя бы чекбоксов?
Немножко измененный пример создания кастомного чекбокса от El Sanchez:
Код:
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application
BitmapResource=BTN:BTNImage.bmp

[B][[/B]Code]
type
 TPaintStruct = record
  hdc: Longint;
  fErase: BOOL;
  rcPaint: TRect;
  fRestore: BOOL;
  fIncUpdate: BOOL;
  rgbReserved: array [0..31] of byte;
 end;

 TCheckBoxArray = array of record
  Control: TWinControl;
  PrevWndProc: Longint;
 end;

const
 BM_GETCHECK = $F0;
 BM_GETSTATE = $F2;
 BST_UNCHECKED = $0;
 BST_CHECKED = $1;
 BST_INDETERMINATE = $2;
 BST_FOCUS = $8;
 BST_HOT = $200;
 BST_PUSHED = $4;
 CN_CTLCOLORSTATIC = $BD38;
 WM_PAINT = $F;
 COLOR_GRAYTEXT = 17;
 COLOR_BTNTEXT = 18;

var
 BTN: TBitmapImage;
 ControlArray: TCheckBoxArray;
 TestChkBox: TNewCheckBox;

function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint;
 external 'GetWindowLongA@user32.dll stdcall';
function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint;
 external 'SetWindowLongA@user32.dll stdcall';
function CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint;
 external 'CallWindowProcA@user32.dll stdcall';
function DrawText(hDC: Longint; lpchText: PAnsiChar; nCount: Integer; var lpRect: TRect; uFormat: UINT): Integer;
 external 'DrawTextA@user32.dll stdcall';
function BeginPaint(hWnd: HWND; var lpPaint: TPaintStruct): Longint;
 external 'BeginPaint@user32.dll stdcall';
function EndPaint(hWnd: HWND; const lpPaint: TPaintStruct): Boolean;
 external 'EndPaint@user32.dll stdcall';
function InvalidateRect(hWnd: HWND; lpRect: Longint; bErase: Boolean): Boolean;
 external 'InvalidateRect@user32.dll stdcall';
function GdiTransparentBlt(hdcDest: Longint; xoriginDest, yoriginDest, wDest, hDest: Integer; hdcSrc: Longint; xoriginSrc, yoriginSrc, wSrc, hSrc: Integer; crTransparent: UINT): Boolean;
 external 'GdiTransparentBlt@gdi32.dll stdcall';
function SetTextColor(hdc: Longint; crColor: DWORD): DWORD;
 external 'SetTextColor@gdi32.dll stdcall';
function SetBkMode(hdc: Longint; iBkMode: Integer): Integer;
 external 'SetBkMode@gdi32.dll stdcall';
function SelectObject(hdc: Longint; hgdiobj: Longint): LongWord;
 external 'SelectObject@gdi32.dll stdcall';
function GetSysColor(nIndex: Integer): DWORD;
 external 'GetSysColor@user32.dll stdcall';

function WndProc(hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint;
var
 i, id: Integer;
 ps: TPaintStruct;
 rs: TRect;
 begin
 Result := 0;
 i := GetWindowLong(hWnd, -21);
 case Msg of
  CN_CTLCOLORSTATIC: InvalidateRect(hWnd, 0, False);
  WM_PAINT: begin
   InvalidateRect(hWnd, 0, True);
   BeginPaint(hWnd, ps);
   case SendMessage(hWnd, BM_GETSTATE, 0, 0) of
    BST_UNCHECKED + BST_FOCUS: id := 9;
    BST_CHECKED + BST_FOCUS: id := 13;
    BST_INDETERMINATE + BST_FOCUS: id := 17;

    BST_UNCHECKED + BST_HOT: id := 10;
    BST_CHECKED + BST_HOT: id := 14;
    BST_INDETERMINATE + BST_HOT: id := 18;

    BST_UNCHECKED + BST_FOCUS + BST_HOT: id := 10;
    BST_CHECKED + BST_FOCUS + BST_HOT: id := 14;
    BST_INDETERMINATE + BST_FOCUS + BST_HOT: id := 18;

    BST_UNCHECKED + BST_FOCUS + BST_HOT + 100: id := 11;
    BST_CHECKED + BST_FOCUS + BST_HOT + 100: id := 15;
    BST_INDETERMINATE + BST_FOCUS + BST_HOT + 100: id := 19;

    BST_UNCHECKED + BST_FOCUS + BST_HOT + 100 - BST_PUSHED: id := 11;
    BST_CHECKED + BST_FOCUS + BST_HOT + 100 - BST_PUSHED: id := 15;
    BST_INDETERMINATE + BST_FOCUS + BST_HOT + 100 - BST_PUSHED: id := 19;

    BST_UNCHECKED: id := 9;
    BST_CHECKED: id := 13;
    BST_INDETERMINATE: id := 17;
   end;
   if not TNewCheckBox(ControlArray[i].Control).Enabled then
   case SendMessage(hWnd, BM_GETCHECK, 0, 0) of
    BST_UNCHECKED: id := 12;
    BST_CHECKED: id := 16;
    BST_INDETERMINATE: id := 20;
   end;
   GdiTransparentBlt(ps.hdc, 0, 0, ps.rcPaint.Bottom, ps.rcPaint.Bottom, btn.Bitmap.Canvas.Handle, id*btn.Bitmap.Height, 0, btn.Bitmap.Height, btn.Bitmap.Height, clFuchsia);
   SelectObject(ps.hdc, TNewCheckBox(ControlArray[i].Control).Font.Handle);
   SetBkMode(ps.hdc, 1);
   if TNewCheckBox(ControlArray[i].Control).Enabled then
    SetTextColor(ps.hdc, GetSysColor(COLOR_BTNTEXT))
   else
    SetTextColor(ps.hdc, GetSysColor(COLOR_GRAYTEXT));
   rs.Left := ps.rcPaint.Bottom;
   rs.Top := (ps.rcPaint.Bottom - TNewCheckBox(ControlArray[i].Control).Font.Size) div 4;
   rs.Right := ps.rcPaint.Right - rs.Left;
   rs.Bottom := ps.rcPaint.Bottom;
   DrawText(ps.hdc, TNewCheckBox(ControlArray[i].Control).Caption, Length(TNewCheckBox(ControlArray[i].Control).Caption), rs, 0);
   EndPaint(hWnd, ps);
  end;
  else Result := CallWindowProc(ControlArray[i].PrevWndProc, hWnd, Msg, wParam, lParam);
 end;
end;

procedure SetOwnerDrawCheckBox(Ctrl: TWinControl);
var
 i: Integer;
 begin
 if Assigned(Ctrl) then begin
  for i := 0 to Ctrl.ControlCount-1 do if Ctrl.Controls[i] is TWinControl then begin
   if (Ctrl.Controls[i] is TNewCheckBox) then begin
    SetArrayLength(ControlArray, GetArrayLength(ControlArray)+1);
    ControlArray[GetArrayLength(ControlArray)-1].Control := TWinControl(Ctrl.Controls[i]);
    ControlArray[GetArrayLength(ControlArray)-1].PrevWndProc := SetWindowLong(TWinControl(Ctrl.Controls[i]).Handle, -4, CallbackAddr('WndProc'));
    SetWindowLong(TWinControl(Ctrl.Controls[i]).Handle, -21, GetArrayLength(ControlArray)-1);
   end;
   if TWinControl(Ctrl.Controls[i]).ControlCount > 0 then SetOwnerDrawCheckBox(TWinControl(Ctrl.Controls[i]));
  end;
 end;
 if not Assigned(Ctrl) then begin
  for i := 0 to GetArrayLength(ControlArray)-1 do SetWindowLong(ControlArray[i].Control.Handle, -4, ControlArray[i].PrevWndProc);
  SetArrayLength(ControlArray, 0);
 end;
end;

procedure InitializeWizard();
 begin
 BTN := TBitmapImage.Create(WizardForm);
 BTN.Bitmap.LoadFromResourceName(HInstance, '_IS_BTN');

 TestChkBox := TNewCheckBox.Create(WizardForm);
 with TestChkBox do begin
  Parent := WizardForm;
  Left := ScaleX(10);
  Top := WizardForm.Bevel.Top + ScaleY(10);
  Font.Name := 'MS Sans Serif';
  Caption := 'Test test test';
 end;
 SetOwnerDrawCheckBox(WizardForm);
end;

procedure DeinitializeSetup();
 begin
 SetOwnerDrawCheckBox(nil);
end;
[HR][/HR]
Или же создать новый чеклистбокс, убрать края, и создать один чекбокс внутри:
Код:
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application
BitmapResource=BTN:BTNImage.bmp

[B][[/B]Code]
var
 ChkListBox: TNewCheckListBox;
 BTN: TBitmapImage;

procedure ListBoxClick(Sender: TObject);
begin
 if ChkListBox.Checked[0] then
  ChkListBox.Font.Color := $2222b2 else ChkListBox.Font.Color := clBlack;
end;

procedure InitializeWizard;
begin
  BTN := TBitmapImage.Create(WizardForm);
  BTN.Bitmap.LoadFromResourceName(HInstance, '_IS_BTN');

  ChkListBox := TNewCheckListBox.Create(WizardForm);
  with ChkListBox do begin
   Parent := WizardForm.SelectDirPage;
   SetBounds(ScaleX(0), ScaleY(130), ScaleX(200), ScaleY(20));
   AddCheckBoxEx('Создать ярлык на рабочем столе', '', 0, True, True, True, True, nil, True);
   WantTabs := True;
   ShowLines := True;
   Font.Color := $2222b2;
   Color := WizardForm.Color;
   BorderStyle := bsNone;
   OnClickCheck := @ListBoxClick;
   LoadBtnBmpFromBitmap(BTN.Bitmap);
  end;
end;
BTNImage.bmp
 

makst

Новичок
Ребята выручайте пожалуйста, скрипт по идее должен работать, компилируется на Ура, но когда начинается установка то сразу "Setup/Uninstall stopped working" что за черт..

Код:
[Setup]
#define GameName "Zeno Clash 2"
#define exeName "ZC2.exe"
#define exeDir "\Binaries\Win32\"

;#define NeedSize "7516192768"

#define NeedMem 512

;#define SecondProgressBar

;#define Components

;#define records

#define facompress

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


AppName={#GameName}
AppVerName={#GameName}
DefaultDirName={pf}\{#GameName}
DefaultGroupName={#GameName}
OutputDir=.
OutputBaseFilename=setup
SetupIconFile=icon.ico
WizardImageFile=wizardimage.bmp
WizardSmallImageFile=wizardsmallimage.bmp
AllowNoIcons=True
#ifdef NeedSize
ExtraDiskSpaceRequired={#NeedSize}
#endif

#ifdef Components

[Types]
Name: full; Description: Full installation; Flags: iscustom

[Components]
Name: gui; Description: ßçûê èíòåðôåéñà | Language; Types: full; Flags: fixed
Name: gui\rus; Description: Ðóññêèé | Russian; Flags: exclusive;
Name: gui\eng; Description: Àíãëèéñêèé | English; Flags: exclusive;
#endif

;[INI]
;Filename: "{app}\Binaries\Win32\steam_api.ini"; Section: "Settings"; Key: "Language"; String: "russian"; Components: gui\rus;
;Filename: "{app}\Binaries\Win32\steam_api.ini"; Section: "Settings"; Key: "Language"; String: "english"; Components: gui\eng;

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"

[Messages]
DiskSpaceMBLabel=Äëÿ óñòàíîâêè ïîòðåáóåòñÿ 3 Ãá ñâîáîäíîãî äèñêîâîãî ïðîñòðàíñòâà
BeveledLabel=    MC_WRX

[CustomMessages]
russian.ExtractedFile=Èçâëåêàåòñÿ ôàéë:
russian.Extracted=Óñòàíîâêà èãðû...
russian.CancelButton=Îòìåíà
russian.Error=Îøèáêà ðàñïàêîâêè!
russian.ElapsedTime=Ïðîøëî:
russian.RemainingTime=Îñòàëîñü:
russian.EstimatedTime=Âñåãî:
russian.AllElapsedTime=Âðåìÿ óñòàíîâêè:

russian.Icons=ßðëûê:
russian.DesktopIcons=ßðëûê íà ðàáî÷åì ñòîëå

;[Registry]
;Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Activision\Prototype 2; ValueType: string; ValueName: InstallPath; ValueData: D:\Games\Prototype 2; Flags: uninsdeletevalue uninsdeletekeyifempty
;Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Activision\Prototype 2; ValueType: string; ValueName: SPExePath; ValueData: D:\Games\Prototype 2\prototype2.exe; Flags: uninsdeletevalue uninsdeletekeyifempty
;Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Activision\Prototype 2; ValueType: string; ValueName: Version; ValueData: 1.0; Flags: uninsdeletevalue uninsdeletekeyifempty
;Root: HKLM; SubKey: SOFTWARE\Wow6432Node\Activision\Prototype 2; ValueType: string; ValueName: language; ValueData: 69; Flags: uninsdeletevalue uninsdeletekeyifempty

[Icons]
Name: {userdesktop}\{#GameName}; Filename: {app}\Binaries\Win32\{#exeName}; WorkingDir: {app}\Binaries\Win32\; Tasks: icons\Desktop; Comment: {#GameName}; Check: CheckError
Name: {group}\Uninstall =ISSkin; Filename: {app}\unins000.exe

; The following code block is used to load the ISS, pass in
; an empty string ('') as the second parameter to LoadSkin to use
; the Blue color scheme, this is the default color scheme for
; Office2007.cjstyles.

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

[Tasks]
Name: icon; Description: {cm:Icons}
Name: icons\Desktop; Description: {cm:DesktopIcons}
Name: Soft; Description: Äîïîëíèòåëüíîå ÏÎ
Name: Soft\DirectX; Description: Óñòàíîâêà  DirectX
Name: Soft\VCRedist; Description: Óñòàíîâêà Microsoft Visual C++
Name: Soft\OpenAL; Description: Óñòàíîâêà OpenAL

[Run]
Filename: {src}\Redist\dxwebsetup.exe; Parameters: /q; WorkingDir: {src}\Redist\; Tasks: Soft\DirectX; Check: CheckError
Filename: {src}\Redist\vcredist_x86.exe; Parameters: /q; WorkingDir: {src}\Redist\; Tasks: Soft\VCRedist; Check: not IsWin64 and CheckError
Filename: {src}\Redist\vcredist_x64.exe; Parameters: /q; WorkingDir: {src}\Redist\; Tasks: Soft\VCRedist; Check: IsWin64 and CheckError
Filename: {src}\Redist\oalinst.exe; Parameters: /q; WorkingDir: {src}\Redist\; Tasks: Soft\OpenAL; Check: CheckError

[Files]
Source: "ISSkinEx.dll"; DestDir: {app}; Flags: dontcopy
Source: "Vista.cjstyles"; DestDir: {tmp}; Flags: dontcopy
Source: "logo.png"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "wizardimage.bmp"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: "isgsg.dll"; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
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: "C:\Users\Max\Desktop\ISDone0.6final\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


[*Code]
{ RedesignWizardFormBegin } // Don't remove this line!
// Don't modify this section. It is generated automatically.
var
  OldEvent_NextButtonClick: TNotifyEvent;
  OldEvent_BackButtonClick: TNotifyEvent;

procedure WizardFormCreate(Sender: TObject); forward;
procedure _NextButtonClick(Sender: TObject); forward;
procedure _BackButtonClick(Sender: TObject); forward;

procedure RedesignWizardForm;
begin
  with WizardForm do
  begin
    OnCreate := @WizardFormCreate;
  end;

  with WizardForm.CancelButton do
  begin
    Left := ScaleX(376);
  end;

  with WizardForm.NextButton do
  begin
    Left := ScaleX(287);
    OldEvent_NextButtonClick := OnClick;
    OnClick := @_NextButtonClick;
  end;

  with WizardForm.BackButton do
  begin
    Left := ScaleX(198);
    OldEvent_BackButtonClick := OnClick;
    OnClick := @_BackButtonClick;
  end;

{ ReservationBegin }
  // This part is for you. Add your specialized code here.

{ ReservationEnd }
end;
// Don't modify this section. It is generated automatically.
{ RedesignWizardFormEnd } // Don't remove this line!

procedure _BackButtonClick(Sender: TObject);
begin
  OldEvent_BackButtonClick(Sender);
end;

procedure WizardFormCreate(Sender: TObject);
begin

end;

procedure _NextButtonClick(Sender: TObject);
begin
  OldEvent_NextButtonClick(Sender);
end;

function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLongA@user32.dll stdcall delayload';
function ssInitialize(hParent:HWND;ssTimeShow:integer;FadeOut:boolean;StretchMode:integer;BkgColor:DWORD):boolean; external 'ssInitialize@files:isgsg.dll stdcall delayload';
procedure ssDeInitialize; external 'ssDeInitialize@files:isgsg.dll stdcall delayload';
procedure ShowSplashScreen(p1:HWND;p2:string;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';

procedure InitializeWizard;
begin
  RedesignWizardForm;
  with Wizardform.WizardSmallBitmapImage do begin
   Width := WizardForm.MainPanel.Width;
   Left := WizardForm.MainPanel.Left;
end;
  Wizardform.PageNameLabel.Hide;
  Wizardform.PageDescriptionLabel.Hide;

  ExtractTemporaryFile('logo.png');
  ExtractTemporaryFile('wizardimage.bmp');
  ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\logo.png',1000,3000,1000,0,255,False,$FFFFFF,10);
  ssInitialize(GetWindowLong(MainForm.Handle,-8),0,False,2,$FF000000);

  WizardForm.WizardBitmapImage.Width:= ScaleX(497);
  WizardForm.WizardBitmapImage2.Width:= ScaleX(497);
  WizardForm.WizardBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\wizardimage.bmp'));
  WizardForm.WizardBitmapImage2.Bitmap.LoadFromFile(ExpandConstant('{tmp}\wizardimage.bmp'));

  WizardForm.WelcomeLabel1.Hide;
  WizardForm.WelcomeLabel2.Hide;
  WizardForm.FinishedLabel.Hide;
  WizardForm.FinishedHeadingLabel.Hide;
end;


const
  PCFonFLY=true;
  notPCFonFLY=false;
var
  LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2,LabelTime3: TLabel;
  ISDoneProgressBar1: TNewProgressBar;
#ifdef SecondProgressBar
  LabelPct2: TLabel;
  ISDoneProgressBar2:TNewProgressBar;
#endif
  MyCancelButton: TButton;
  ISDoneCancel:integer;
  ISDoneError:boolean;
  PCFVer:double;

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

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)+'%';
#ifdef SecondProgressBar
  if CurrentPct<=1000 then ISDoneProgressBar2.Position := CurrentPct;
  LabelPct2.Caption := IntToStr(CurrentPct div 10)+'.'+chr(48 + CurrentPct mod 10)+'%';
#endif
  LabelCurrFileName.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));
  LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
  LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
  Result := ISDoneCancel;
end;

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;
  LabelCurrFileName.Hide;
  LabelTime1.Hide;
  LabelTime2.Hide;
  MyCancelButton.Hide;
#ifdef SecondProgressBar
  ISDoneProgressBar2.Hide;
  LabelPct2.Hide;
#endif
end;

procedure CreateControls;
var PBTop:integer;
begin
  PBTop:=ScaleY(50);
  ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);
  with ISDoneProgressBar1 do begin
    Parent   := WizardForm.InstallingPage;
    Height   := WizardForm.ProgressGauge.Height;
    Left     := ScaleX(0);
    Top      := PBTop;
    Width    := ScaleX(365);
    Max      := 1000;
  end;
  LabelPct1 := TLabel.Create(WizardForm);
  with LabelPct1 do begin
    Parent    := WizardForm.InstallingPage;
    AutoSize  := False;
    Left      := ISDoneProgressBar1.Width+ScaleX(5);
    Top       := ISDoneProgressBar1.Top + ScaleY(2);
    Width     := ScaleX(80);
  end;
  LabelCurrFileName := TLabel.Create(WizardForm);
  with LabelCurrFileName do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := ISDoneProgressBar1.Width+ScaleX(30);
    Left     := ScaleX(0);
    Top      := ScaleY(30);
  end;
#ifdef SecondProgressBar
  PBTop:=PBTop+ScaleY(25);
  ISDoneProgressBar2 := TNewProgressBar.Create(WizardForm);
  with ISDoneProgressBar2 do begin
    Parent   := WizardForm.InstallingPage;
    Left     := ScaleX(0);
    Top      := PBTop+ScaleY(8);
    Width    := ISDoneProgressBar1.Width;
    Max      := 1000;
    Height   := WizardForm.ProgressGauge.Height;
  end;
  LabelPct2 := TLabel.Create(WizardForm);
  with LabelPct2 do begin
    Parent    := WizardForm.InstallingPage;
    AutoSize  := False;
    Left      := ISDoneProgressBar2.Width+ScaleX(5);
    Top       := ISDoneProgressBar2.Top + ScaleY(2);
    Width     := ScaleX(80);
  end;
#endif
  LabelTime1 := TLabel.Create(WizardForm);
  with LabelTime1 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := ISDoneProgressBar1.Width div 2;
    Left     := ScaleX(0);
    Top      := PBTop + ScaleY(35);
  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;
  MyCancelButton:=TButton.Create(WizardForm);
  with MyCancelButton do begin
    Parent:=WizardForm;
    Width:=ScaleX(135);
    Caption:=ExpandConstant('{cm:CancelButton}');
    Left:=ScaleX(360);
    Top:=WizardForm.cancelbutton.top;
    OnClick:=@CancelButtonOnClick;
  end;
end;

Procedure CurPageChanged(CurPageID: Integer);
Begin
  if (CurPageID = wpFinished) and ISDoneError then
  begin
    WizardForm.Caption:= ExpandConstant('{cm:Error}');
    WizardForm.FinishedLabel.Font.Color:= clRed;
    WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ;
  end;
end;

function CheckError:boolean;
begin
  result:= not ISDoneError;
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  //Anee iaiaoiaeii, ii?ii iiiaiyou ia ssPostInstall
    WizardForm.ProgressGauge.Hide;
    WizardForm.CancelButton.Hide;
    CreateControls;
    WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
    ISDoneCancel:=0;

// ?aniaeiaea anao iaiaoiaeiuo oaeeia a iaieo {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'); //onei?yao ?aniaeiaeo .arc a?oeaia.
#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');

// Iiaaioaaeeaaai ia?aiaiio?, niaa??auo? an? eioi?iaoe? i auaaeaiiuo eiiiiiaioao aey ISDone.dll
// iaeneioi 96 eiiiiiaioia.
    Comps1:=0; Comps2:=0; Comps3:=0;
#ifdef Components
    TmpValue:=1;
    if IsComponentSelected('gui\rus') then Comps1:=Comps1+TmpValue;     //eiiiiiaio 1
    TmpValue:=TmpValue*2;
    if IsComponentSelected('gui\eng') then Comps1:=Comps1+TmpValue;     //eiiiiiaio 2
//  .....
// ni. ni?aaeo
#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,0.40) then break;
        if not FileSearchInit(false) then break;

        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\setup-1.bin'), ExpandConstant('{app}\ZC2Game\CookedPC\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\setup-2.bin'), ExpandConstant('{app}\ZC2Game\CookedPC\Môps\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\setup-3.bin'), ExpandConstant('{app}\ZC2Game\CookedPC\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\setup-4.bin'), ExpandConstant('{app}\ZC2Game\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\setup-5.bin'), ExpandConstant('{app}\'), '', false, '', '', '', notPCFonFLY) then break;
(*      if not ISArcExtract ( 0, 0, ExpandConstant('{src}\setup4.bin'), ExpandConstant('{app}\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 1, 0, ExpandConstant('{src}\rus.bin'), ExpandConstant('{app}\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 2, 0, ExpandConstant('{src}\eng.bin'), ExpandConstant('{app}'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\sd-6.bin'), ExpandConstant('{app}'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\sd-7.bin'), ExpandConstant('{app}\Data\Audio\HK\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\sd-8.bin'), ExpandConstant('{app}\Data\Audio\HK\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\sd-9.bin'), ExpandConstant('{app}\Data\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\ds2-4.bin'), ExpandConstant('{app}'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        if not ISSRepExtract( 0, 0, ExpandConstant('{app}\anim_streams.srep'),ExpandConstant('{app}\anim_streams.pcf'), true                         ) then break;
        if not ISPrecompExtract ( 0, 0, ExpandConstant('{app}\anim_streams.pcf'), ExpandConstant('{app}\media\anim_streams.upak'), true                         ) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\ds2-5.bin'), ExpandConstant('{app}'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        if not ISSRepExtract( 0, 0, ExpandConstant('{app}\maps.srep'),ExpandConstant('{app}\maps.pcf'), true                         ) then break;
        if not ISPrecompExtract ( 0, 0, ExpandConstant('{app}\maps.pcf'), ExpandConstant('{app}\media\maps.upak'), true                         ) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\ds2-6.bin'), ExpandConstant('{app}'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        if not ISSRepExtract( 0, 0, ExpandConstant('{app}\media.srep'),ExpandConstant('{app}\media.pcf'), true                         ) then break;
        if not ISPrecompExtract ( 0, 0, ExpandConstant('{app}\media.pcf'), ExpandConstant('{app}\media\media.upak'), true                         ) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\ds2-7.bin'), ExpandConstant('{app}\media\sounds_streamed\PC\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\ds2-8.bin'), ExpandConstant('{app}\media\sounds_streamed\PC\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\ds2-9.bin'), ExpandConstant('{app}\media\video\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\ds2-10.bin'), ExpandConstant('{app}\media\video\'), '', false, '', '', '', notPCFonFLY) then break;
        if not ISArcExtract ( 0, 0, ExpandConstant('{src}\ds2-11.bin'), ExpandConstant('{app}\media\video\'), '', false, '', '', '', notPCFonFLY) then break;
*)


        //if not ISArcExtract ( 0, 0, ExpandConstant('{app}\files.bin'),ExpandConstant('{app}\'), '', true, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        //if not ISArcExtract ( 0, 0, ExpandConstant('{src}\setup7.bin'), ExpandConstant('{app}'), '', false, '', '', '', notPCFonFLY) then break;

//      if not ISArcExtract ( 0, 0, ExpandConstant('{app}\file.bin'), ExpandConstant('{app}\'), '', true, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
//      if not ISArcExtract ( 0, 0, ExpandConstant('{src}\DLC1.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
//      if not ISSRepExtract( 0, 0, ExpandConstant('{app}\DLC.srep'),ExpandConstant('{app}\DLC.pcf'), true                         ) then break;
//      if not ISPrecompExtract ( 0, 0, ExpandConstant('{app}\DLC.pcf'), ExpandConstant('{app}\DLC.arc'), true                         ) then break;
//      if not ISArcExtract ( 0, 0, ExpandConstant('{app}\DLC.arc'), ExpandConstant('{app}\DLC\'), '', true, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;

//      if not ISArcExtract ( 0, 0, ExpandConstant('{src}\envs.arc'), ExpandConstant('{app}\envs.srep'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
//      if not ISSRepExtract ( 0, 0, ExpandConstant('{src}\envs.srep'), ExpandConstant('{app}\envs.pcf'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
//      if not ISPrecompExtract ( 0, 0, ExpandConstant('{src}\envs.pcf'), ExpandConstant('{app}\'), '', false, '', '', ExpandConstant('{app}\Sounds.arc'), notPCFonFLY {PCFonFLY}) then break;
//      if not ISArcExtract ( 0, 0, ExpandConstant('{src}\Sounds.arc'), ExpandConstant('{app}\Sounds.srep'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
//      if not ISSRepExtract ( 0, 0, ExpandConstant('{src}\Sounds.srep'), ExpandConstant('{app}\Sounds.pcf'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
//      if not ISPrecompExtract ( 0, 0, ExpandConstant('{src}\Sounds.pcf'), ExpandConstant('{app}\'), '', false, '', '', ExpandConstant('{app}\TheBlob.arc'), notPCFonFLY {PCFonFLY}) then break;
//      if not ISArcExtract ( 0, 0, ExpandConstant('{src}\TheBlob.arc'), ExpandConstant('{app}\TheBlob.srep'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
//      if not ISPrecompExtract ( 0, 0, ExpandConstant('{src}\TheBlob.pcf'), ExpandConstant('{app}\envs\'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

//    aaeaa iaoiayony caeiiiaioe?iaaiua i?eia?u ?acee?iuo ooieoee ?aniaeiaee (?oiau ea?aue ?ac ia eaceou a ni?aaeo ca i?eia?aie)
(*
        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, 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 ('Ii?aeoenoa, anoaauoa aoi?ie aene e ai?aeoanu aai eieoeaeecaoee.', ExpandConstant('{src}'),'CODMW_2.arc') then break;

//    ?aniaeiaea a?oiiu oaeeia iin?aanoaii aiaoiaai i?eei?aiey

        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;
  end;
  if (CurStep=ssPostInstall) and ISDoneError then begin
    Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
  end;
end;

// Importing LoadSkin API from ISSkin.DLL
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin@files:isskinex.dll stdcall';

// Importing UnloadSkin API from ISSkin.DLL
procedure UnloadSkin();
external 'UnloadSkin@files:isskinex.dll stdcall';

// Importing ShowWindow Windows API from User32.DLL
function ShowWindow(hWnd: Integer; uType: Integer): Integer;
external 'ShowWindow@user32.dll stdcall';

function InitializeSetup(): Boolean;
begin
	ExtractTemporaryFile('Vista.cjstyles');
	LoadSkin(ExpandConstant('{tmp}\Vista.cjstyles'), '');
	Result := True;
end;

procedure DeinitializeSetup();
begin
	// Hide Window before unloading skin so user does not get
	// a glimse of an unskinned window before it is closed.
	ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
	UnloadSkin();
  ssDeInitialize;
end;
Спасибо заранее.
 

LexBell

Борода
Супер модератор
kkels, в архив с файлами и залей куда-нибудь.
 

makst

Новичок
Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.
Сверху