Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Новый участник


Сообщения: 2
Благодарности: 0

Профиль | Отправить PM | Цитировать


Не срабатывает кнопка отмены во время распаковки файлов помогите весь код просмотрел так и не нашол причину


Код: Выделить весь код
const
  PCFonFLY=true;
  notPCFonFLY=false;

var
  Enabled: Boolean;
  hCancelBtn, hNextBtn, hBackBtn, hDirBrowseBtn, hGroupBrowseBtn: HWND;
  Welcomelbl1, Selectlbl1, Selectlbl2, MainLabel, Mb1, Mb2, NoIconsLabel, islbl1, islbl2, islbl3: TLabel;
  WFButtonFont: TFont;
  form, form1: Longint;
  NoIconsCheck: TNewCheckBox;
  IntList, VoiceList: TNewCheckListBox;
  ISDoneCancel: Integer;
  ISDoneError: Boolean;
  PCFVer: Double;
  s: AnsiString;
  InputPage: TInputQueryWizardPage;
  CaptionLabel: TLabel;

function ReleaseCapture: Longint; external 'ReleaseCapture@user32.dll stdcall';

procedure LabelOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ReleaseCapture;
  SendMessage(WizardForm.Handle, $0112, $F012, 0)
end;

#include "AddIss\botva2.iss"
#include "AddIss\progressbar.iss"

var
  ISDonePB: TImgPB;

function InitializeSetup:boolean;
begin
  if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then ExtractTemporaryFile('botva2.dll');
  if not FileExists(ExpandConstant('{tmp}\b2p.dll')) then ExtractTemporaryFile('b2p.dll');
  Result:=True;
end;

function cm(s: PAnsiChar): String;
begin
  Result:= ExpandConstant('{cm:'+s+'}');
end;

///////////////////////////////////////////////////////////////////////////////////////////////////
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 ImgPBSetPosition(ISDonePB, OveralPct);
  WizardForm.Caption:= s + ' - ' + IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
  islbl1.Caption:= cm('Extracted') + ' ' + IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
  islbl2.Caption:= MinimizePathName(ExpandConstant('{app}\')+CurrentFile, islbl2.Font, ScaleX(400));
  Result := ISDoneCancel;
end;

procedure CancelButtonOnClick(hBtn: HWND);
begin
  SuspendProc;
  if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then begin
   ISDoneCancel:=1;
   islbl1.Caption:= cm('rbc');
  end;
  ResumeProc;
end;


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

//************************************************ [Начало - Загрузка изображений и подготовка визарда] ***************************************************//
procedure CreateWizardImg;
begin
with WizardForm do begin
 ClientWidth:=ScaleX(623);
 ClientHeight:=ScaleY(382);
 InnerNotebook.Hide;
 OuterNotebook.Hide;
 Bevel.Hide;
 Center;
 Color:= $191919;
end;

  ImgLoad(WizardForm.Handle, 'fon.png', ScaleX(0), ScaleY(0), WizardForm.ClientWidth, WizardForm.ClientHeight, True, True);
  form:= ImgLoad(WizardForm.Handle, 'form.png', ScaleX(0), ScaleY(0), WizardForm.ClientWidth, WizardForm.ClientHeight, True, True);
  form1:= ImgLoad(WizardForm.Handle, 'form1.png', ScaleX(0), ScaleY(0), WizardForm.ClientWidth, WizardForm.ClientHeight, True, True);
  ImgLoad(WizardForm.Handle, 'logo.png', ScaleX(20), ScaleY(326), ScaleX(190), ScaleY(39), True, True);

  ImgSetVisibility(form1, false);

  ImgApplyChanges(WizardForm.Handle);
end;
//************************************************ [Конец - Загрузка изображений и подготовка визарда] ***************************************************//

//************************************************ [Начало - Текстуры кнопок] ***************************************************//

procedure SetStateNewButtons;
begin
  with WizardForm.BackButton do begin
    BtnSetText(hBackBtn,PAnsiChar(Caption));
    BtnSetVisibility(hBackBtn,Visible);
    BtnSetEnabled(hBackBtn,Enabled);
  end;
  with WizardForm.NextButton do begin
    BtnSetText(hNextBtn,PAnsiChar(Caption));
    BtnSetVisibility(hNextBtn,Visible);
    BtnSetEnabled(hNextBtn,Enabled);
  end;
  with WizardForm.CancelButton do begin
    BtnSetText(hCancelBtn,PAnsiChar(Caption));
    BtnSetVisibility(hCancelBtn,Visible);
    BtnSetEnabled(hCancelBtn,Enabled);
  end;
  BtnSetText(hDirBrowseBtn,PAnsiChar(WizardForm.DirBrowseButton.Caption));
  BtnSetText(hGroupBrowseBtn,PAnsiChar(WizardForm.GroupBrowseButton.Caption));
end;

procedure WizardFormBtnClick(hBtn:HWND);
var
  Btn: TButton;
begin
  case hBtn of
    hCancelBtn: Btn:=WizardForm.CancelButton;
    hNextBtn: Btn:=WizardForm.NextButton;
    hBackBtn: Btn:=WizardForm.BackButton;
    hDirBrowseBtn: Btn:=WizardForm.DirBrowseButton;
    hGroupBrowseBtn: Btn:=WizardForm.GroupBrowseButton;
  end;
  Btn.OnClick(Btn);
  SetStateNewButtons;
  BtnRefresh(hBtn);
end;

procedure NoIconsCheckClick(Sender: TObject);
begin
  if NoIconsCheck.Checked then begin
    WizardForm.GroupEdit.Enabled:= false;
    WizardForm.GroupBrowseButton.Enabled:= false;
    BtnSetEnabled(hGroupBrowseBtn, false);
  end else begin
    WizardForm.GroupEdit.Enabled:= true;
    WizardForm.GroupBrowseButton.Enabled:= true;
    BtnSetEnabled(hGroupBrowseBtn, true);
  end;
  WizardForm.NoIconsCheck.Checked:= NoIconsCheck.Checked;
  WizardForm.GroupEdit.Color:= clblack;
end;

procedure NoIconsLabelClick(Sender: TObject);
begin
  NoIconsCheck.Checked:= not NoIconsCheck.Checked;
  NoIconsCheckClick(nil);

end;

procedure ButtonsTextures;
begin
  WFButtonFont:=TFont.Create;
  WFButtonFont.Style:=[fsBold];
  WFButtonFont.Name:= 'Arial';
  WFButtonFont.Size:= 8;

  with WizardForm.BackButton do begin
    hBackBtn:= BtnCreate(WizardForm.Handle, ScaleX(Left+28), ScaleY(Top+3), ScaleX(100), ScaleY(35), 'button.png', 1, False);
    BtnSetEvent(hBackBtn, BtnClickEventID, CallbackAddr('WizardFormBtnClick'));
    BtnSetFont(hBackBtn, WFButtonFont.Handle);
    BtnSetFontColor(hBackBtn, clblack, clblack, clblack, clblack);
    Width:=0;
    Height:=0;
  end;

  with WizardForm.NextButton do begin
    hNextBtn:=BtnCreate(WizardForm.Handle, ScaleX(Left+55), ScaleY(Top+3), ScaleX(100), ScaleY(35), 'button.png', 1, False);
    BtnSetEvent(hNextBtn,BtnClickEventID, CallbackAddr('WizardFormBtnClick'));
    BtnSetFont(hNextBtn,WFButtonFont.Handle);
    BtnSetFontColor(hNextBtn, clblack, clblack, clblack, clblack);
    Width:=0;
    Height:=0;
  end;

  with WizardForm.CancelButton do begin
    hCancelBtn:=BtnCreate(WizardForm.Handle, ScaleX(Left+85), ScaleY(Top+3), ScaleX(100), ScaleY(35), 'button.png', 1, False);
    BtnSetEvent(hCancelBtn,BtnClickEventID, CallbackAddr('WizardFormBtnClick'));
    BtnSetFont(hCancelBtn,WFButtonFont.Handle);
    BtnSetFontColor(hCancelBtn, clblack, clblack, clblack, clblack);
    Width:=0;
    Height:=0;
  end;

  with WizardForm.DirBrowseButton do begin
    hDirBrowseBtn:=BtnCreate(WizardForm.Handle, ScaleX(Left+90), ScaleY(Top+164), ScaleX(100), ScaleY(35), 'button.png', 1, False);
    BtnSetEvent(hDirBrowseBtn,BtnClickEventID, CallbackAddr('WizardFormBtnClick'));
    BtnSetFont(hDirBrowseBtn,WFButtonFont.Handle);
    BtnSetFontColor(hDirBrowseBtn, clblack, clblack, clblack, clblack);
    Width:=0;
    Height:=0;
  end;

  with WizardForm.GroupBrowseButton do begin
    hGroupBrowseBtn:=BtnCreate(WizardForm.Handle, ScaleX(Left+90), ScaleY(Top+164), ScaleX(100), ScaleY(35), 'button.png', 1, False);
    BtnSetEvent(hGroupBrowseBtn,BtnClickEventID, CallbackAddr('WizardFormBtnClick'));
    BtnSetFont(hGroupBrowseBtn,WFButtonFont.Handle);
    BtnSetFontColor(hGroupBrowseBtn, clblack, clblack, clblack, clblack);
    Width:=0;
    Height:=0;
  end;
end;

//************************************************ [Конец - Текстуры кнопок] ***************************************************//

//************************************************ [Начало - Место на жестком диске] ***************************************************//

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 MbOrTB(Float: Extended): string;
begin
  if Float<1024 then Result:=NumToStr(Float)+' MB'
  else if (Float/1024)<1024 then Result:=NumToStr(Float/1024)+' GB'
  else if (Float/(1024*1024))<1024 then Result:=NumToStr(Float/(1024*1024))+' TB'
end;

procedure GetFreeSpaceCaption(Sender: TObject);
var
  Enable: Boolean;
  Path: AnsiString;
  FreeMB, TotalMB: Cardinal;
begin
  Path:= ExtractFileDrive(WizardForm.DirEdit.Text);
  Enable:= GetSpaceOnDisk(Path, True, FreeMB, TotalMB);

  if not Enable then begin
    mb1.Caption:= cm('FreeSpace') + ' ' + '0 Мб';
    mb2.Caption:= cm('NeedSpace') + ' ' + MborTb({#NeedSize});
    WizardForm.NextButton.Enabled:= false;
    BtnSetEnabled(hNextBtn, false);
    Exit;
  end;
  
  if Enable then begin
    mb1.Caption:= cm('FreeSpace') + ' ' + MbOrTb(FreeMB);
    mb2.Caption:= cm('NeedSpace') + ' ' + MborTb({#NeedSize});
    WizardForm.NextButton.Enabled:= true;
    BtnSetEnabled(hNextBtn, true);
  end;
  
  if FreeMB < {#NeedSize} then begin WizardForm.NextButton.Enabled:= false; BtnSetEnabled(hNextBtn, false); end else begin WizardForm.NextButton.Enabled:= true; BtnSetEnabled(hNextBtn, true); end;
end;

//************************************************ [Конец - Место на жестком диске] ***************************************************//

//************************************************ [Начало - Создание лебелов] ***************************************************//
procedure CreateLabel;
begin
Welcomelbl1:= TLabel.Create(WizardForm);
with Welcomelbl1 do
begin
  Left:= ScaleX(80);
  Top:= ScaleY(244);
  Width:= ScaleX(450);
  Height:= ScaleY(450);
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  Font.Name:= 'Arial';
  Font.Size:= 8;
  Font.Color:= clwhite;
  Font.Style := [fsBold];
  Alignment := taCenter;
  Parent:= WizardForm;
  Caption:= cm('Welcome');
end;

with WizardForm.DirEdit do begin
  Parent:= WizardForm;
  Left:= ScaleX(100);
  Top:= ScaleY(250);
  Color:= clblack;
  Font.Name:= 'Arial';
  Font.Size:= 9;
  Font.Color:= clwhite;
  Width:= ScaleX(324);
  Height:= ScaleY(18);
end;

with WizardForm.GroupEdit do begin
  Parent:= WizardForm;
  Left:= ScaleX(100);
  Top:= ScaleY(250);
  Color:= clblack;
  Font.Name:= 'Arial';
  Font.Size:= 9;
  Font.Color:= clwhite;
  Width:= ScaleX(324);
  Height:= ScaleY(18);
end;

Selectlbl1:=TLabel.Create(WizardForm);
with Selectlbl1 do
begin
  Left:= ScaleX(100);
  Top:= ScaleY(200);
  Width:= ScaleX(450);
  Height:= ScaleY(200);
  AutoSize:= false;
  WordWrap:= true;
  Font.Name:= 'Arial';
  Font.Size:= 8
  Font.Style := [fsBold];
  Transparent:= true;
  Font.Color:= clwhite;
  Parent:= WizardForm;
  Caption:= cm('dir1');
end;

Selectlbl2:=TLabel.Create(WizardForm);
with Selectlbl2 do
begin
  Left:= ScaleX(100);
  Top:= ScaleY(216);
  Width:= ScaleX(450);
  Height:= ScaleY(200);
  AutoSize:= false;
  WordWrap:= true;
  Font.Name:= 'Arial';
  Font.Size:= 8
  Font.Style := [fsBold];
  Transparent:= true;
  Font.Color:= clwhite;
  Parent:= WizardForm;
  Caption:= cm('dir2');
end;

//with WizardForm.DirBrowseButton do begin
//  Parent:= WizardForm;
//  Left:= ScaleX(720);
//  Top:= ScaleY(200);
//  Font.Name:= 'Arial';
//  Font.Size:= 9;
//  Font.Color:= $aeacac;
//end;

//with WizardForm.GroupBrowseButton do begin
//  Parent:= WizardForm;
//  Left:= ScaleX(720);
//  Top:= ScaleY(200);
//  Font.Name:= 'Arial';
//  Font.Size:= 9;
//  Font.Color:= $aeacac;
//end;

mb1:=TLabel.Create(WizardForm);
with mb1 do
begin
  Left:= ScaleX(100);
  Top:= ScaleY(278);
  Width:= ScaleX(450);
  Height:= ScaleY(200);
  AutoSize:= false;
  WordWrap:= true;
  Font.Name:= 'Arial';
  Font.Size:= 8
  Font.Style := [fsBold];
  Transparent:= true;
  Font.Color:= clwhite;
  Parent:= WizardForm;
end;

mb2:=TLabel.Create(WizardForm);
with mb2 do
begin
  Left:= ScaleX(100);
  Top:= ScaleY(295);
  Width:= ScaleX(450);
  Height:= ScaleY(200);
  AutoSize:= false;
  WordWrap:= true;
  Font.Name:= 'Arial';
  Font.Size:= 8
  Font.Style := [fsBold];
  Transparent:= true;
  Font.Color:= clwhite;
  Parent:= WizardForm;
end;

WizardForm.DirEdit.OnChange:= @GetFreeSpaceCaption;

NoIconsCheck:= TNewCheckbox.Create(WizardForm);
  with NoIconsCheck do
   begin
    Left:= ScaleX(100);
    Top:= ScaleY(280);
    Width:= ScaleX(13);
    Height:= ScaleY(13);
    Parent:= WizardForm;
    OnClick:= @NoIconsCheckClick;
   end;

  ExtractTemporaryFile('1.bmp');
 
with WizardForm.ComponentsList do begin
  LoadBGBmpFromFile(ExpandConstant('{tmp}\1.bmp'), Left+100, Top+150);
  Parent:= WizardForm;
  Font.Name:= 'Arial';
  Font.Size:= 8
  Font.Style := [fsBold];
  Font.Color:= clwhite;
  left:= ScaleX(100);
  BorderStyle:= bsNone;
  Top:= ScaleY(200);
  Height:= Height - 50;
end;
  DeleteFile(ExpandConstant('{tmp}\1.bmp'));
  
islbl1:=TLabel.Create(WizardForm);
with islbl1 do
begin
  Left:= ScaleX(100);
  Top:= ScaleY(255);
  Width:= ScaleX(450);
  Height:= ScaleY(200);
  AutoSize:= false;
  WordWrap:= true;
  Font.Name:= 'Arial';
  Font.Size:= 8
  Font.Style := [fsBold];
  Transparent:= true;
  Font.Color:= clwhite;
  Parent:= WizardForm;
  Caption:= cm('Extracted');
end;

islbl2:=TLabel.Create(WizardForm);
with islbl2 do
begin
  Left:= ScaleX(100);
  Top:= ScaleY(270);
  Width:= ScaleX(450);
  Height:= ScaleY(200);
  AutoSize:= false;
  WordWrap:= true;
  Font.Name:= 'Arial';
  Font.Size:= 8
  Font.Style := [fsBold];
  Transparent:= true;
  Font.Color:= clwhite;
  Parent:= WizardForm;
end;

NoIconsLabel:=TLabel.Create(WizardForm);
with NoIconsLabel do
 begin
  Left:= ScaleX(120);
  Top:= ScaleY(280);
  Width:= ScaleX(450);
  Height:= ScaleY(200);
  AutoSize:= false;
  Font.Name:= 'Arial';
  Font.Size:= 8
  Font.Style := [fsBold];
  Transparent:= true;
  Font.Color:= clwhite;
  Parent:= WizardForm;
  Caption:= cm('nic');
  OnClick:= @NoIconsLabelClick;
 end;
end;
//************************************************ [Конец - Создание лебелов] ***************************************************//

function IniStr(Input: String): String;
begin
    Result := InputPage.Values[0];
end;

procedure createInPage();
begin
  InputPage := CreateInputQueryPage(wpSelectDir, #0, #0, #0);

  InputPage.Add(#0, False);
  with InputPage do
  begin
    Edits[0].Parent:= WizardForm;
    Edits[0].SetBounds(ScaleX(100), ScaleX(250), ScaleX(324), ScaleY(18));
    Edits[0].Color:= clblack;
    Edits[0].Font.Name:= 'Arial';
    Edits[0].Font.Size:= 9;
    Edits[0].Font.Color:= clwhite;

    CaptionLabel:=TLabel.Create(WizardForm);
    with CaptionLabel do
    begin
      Parent:= WizardForm;
      SetBounds(ScaleX(100), ScaleX(200), ScaleX(324), ScaleY(26));
      AutoSize:= false;
      WordWrap := True;
      Font.Name:= 'Arial';
      Font.Size:= 8
      Font.Style := [fsBold];
      Transparent:= true;
      Font.Color:= clwhite;
      Caption:= 'Введите желаемый ник в игре.'
    end;
  end;
end;

procedure InitializeWizard;
begin
  s:= WizardForm.Caption;
  Enabled:= true;
  CreateLabel;
  CreateWizardImg;
  ButtonsTextures;
  createInPage();
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  SetStateNewButtons;
  
  Welcomelbl1.Hide;
  WizardForm.DirEdit.Hide;
  WizardForm.GroupEdit.Hide;
  Selectlbl1.Hide;
  Selectlbl2.Hide;
  BtnSetVisibility(hDirBrowseBtn, false);
  BtnSetVisibility(hGroupBrowseBtn, false);
  mb1.Hide;
  mb2.Hide;
  NoIconsCheck.Hide;
  NoIconsLabel.Hide;
  WizardForm.ComponentsList.Hide;
  islbl1.Hide;
  InputPage.Edits[0].Hide;
  CaptionLabel.Hide;

  if CurPageID = wpWelcome then
   begin
     Welcomelbl1.Show;
     ImgSetVisibility(form, true);
     ImgSetVisibility(form1, false);
   end;

  if CurPageID = wpSelectDir then
   begin
    GetFreeSpaceCaption(nil);
    Selectlbl2.Caption:= cm('Dir2');
    WizardForm.DirEdit.Show;
    Selectlbl1.Show;
    Selectlbl1.Caption:= cm('Dir1');
    Selectlbl2.Show;
    BtnSetVisibility(hDirBrowseBtn, true);
    ImgSetVisibility(form1, true);
    ImgSetVisibility(form, false);
    mb1.Show;
    mb2.Show;
   end;
   
  if CurPageID = InputPage.ID then
  begin
    InputPage.Edits[0].Show;
    CaptionLabel.Show;
  end;

  if CurPageID = wpSelectComponents then WizardForm.ComponentsList.Show;

  if CurPageID = wpSelectProgramGroup then
   begin
     Selectlbl1.Caption:= cm('Group1');
     Selectlbl1.Show;
     Selectlbl2.Show;
     Selectlbl2.Caption:= cm('Dir2');
     WizardForm.GroupEdit.Show;
     BtnSetVisibility(hGroupBrowseBtn, true);
     NoIconsCheck.Show;
     NoIconsLabel.Show;
     WizardForm.NextButton.Caption:= 'Установить';
   end;

  if CurPageID = wpSelectTasks then
   begin

   end;

  if CurPageID = wpReady then
  begin                                                                                                
    ImgSetVisibility(form1, true);
  end;

  if CurPageID = wpInstalling then
  begin
    ImgSetVisibility(form, true);
    ImgSetVisibility(form1, false);
    islbl1.Show;
  end;

  if CurPageID = wpFinished then
  begin
    ImgSetVisibility(form, true);
    islbl2.Hide;
    Welcomelbl1.Show;
    Welcomelbl1.Caption:= cm('Fin');
    Welcomelbl1.Top:= Welcomelbl1.Top+ScaleY(5);
  end;

  if (CurPageID = wpFinished) and ISDoneError then
   begin
     Welcomelbl1.Show;
     Welcomelbl1.Font.Color:= clred;
     Welcomelbl1.Caption:= cm('FinError');
   end;
  ImgApplyChanges(WizardForm.Handle);
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;
    ISDonePB:= ImgPBCreate(WizardForm.Handle, ExpandConstant('pb2.png'),ExpandConstant('pb1.png'), ScaleX(100), ScaleY(290), ScaleX(420), ScaleY(19));

    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

// Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для 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'), $F777, Comps1,Comps2,Comps3, MainForm.Handle, 0, @ProgressCallback) then begin
      repeat
        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}\*.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;
      ImgPBDelete(ISDonePB);
      islbl2.Hide;
      islbl1.Caption:= SetupMessage(msgStatusRunProgram);
      ISDoneStop;
    end;
    WizardForm.CancelButton.Visible:=true;
    WizardForm.CancelButton.Enabled:=false;
  end;
  if (CurStep=ssPostInstall) and ISDoneError then begin
    Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
  end;
end;

procedure DeinitializeSetup;
begin
  if Enabled then gdipShutdown;
  WizardForm.Free;
end;

Отправлено: 18:57, 16-01-2014 | #1858