1. Уважаемые гости и пользователи форума.
    Администрация настоятельно рекомендует не регистрировать несколько аккаунтов для одного пользователя. При выявлении наличия мультиаккаунтов будут заблокированы все учетные записи данного пользователя.
    Аккаунты, зарегистрированные на временную почту будут также заблокированы.

How Create Custom Setup with Inno Setup?

Тема в разделе "Inno Setup", создана пользователем magsoud, 1 дек 2018.

Метки:
  1. Новичок

    Регистрация:
    1 дек 2018
    Сообщения:
    6
    Симпатии:
    0
    Пол:
    Мужской

    Вложения:

  2. Ветеран Супер модератор

    Регистрация:
    5 мар 2016
    Сообщения:
    383
    Симпатии:
    405
    Пол:
    Мужской
    magsoud, hello... this...

    Код (Inno):
    #define NeedSize 4380
    #define NeedInstallSize 7890

    [Setup]
    AppVersion=1.5
    AppName=My Application
    DefaultDirName={sd}\My Application
    LicenseFile=ReadMe.txt

    [Files]
    DestName: "0.bmp"; Source: "0.bmp"; Flags: dontcopy solidbreak
    DestName: "1.bmp"; Source: "1.bmp"; Flags: dontcopy solidbreak

    [Languages]
    Name: en; MessagesFile: compiler:Languages\English.isl
    Name: ru; MessagesFile: compiler:Languages\Russian.isl

    [CustomMessages]
    en.Group1=Select mode:
    ru.Group1=Выберете режим:

    en.Group2=Additional icons:
    ru.Group2=Дополнительны значки:

    en.Radio0=Install Smart Defrag Pro
    ru.Radio0=Установить Smart Defrag Pro

    en.Radio1=Unpacking the Portable Version
    ru.Radio1=Распаковать Portable версию

    en.Check0=Create a desctop icon
    ru.Check0=Создать ярлык на Рабочем столе

    en.Check1=Create a Quick Launch icon
    ru.Check1=Ярлык на Панели быстрого запуска

    en.Check2=Create a taskbar icon
    ru.Check2=Создать ярлык в панели задач

    en.Check3=Start with Windows
    ru.Check3=Запускать с Windows

    [Code]
    var
      MyPage: TWizardPage;
      Image: array[0..3] of TBitmapImage;
      MyGroupBox: array[0..2] of TNewGroupBox;
      MyRadioBox: array[0..1] of TNewRadioButton;
      MyCheckBox: array[0..3] of TNewCheckBox;

      TotalSpaceLabel, FreeSpaceLabel, NeedSpacelabel, InstallSpaceLabel: TLabel;
      FreeMB, TotalMB: Cardinal;

    function NumToStr(Float: Extended): String;
    begin
      Result:= Format('%.2f', [Float]);
      StringChange(Result, ',', '.');
      while ( Pos('.', Result) > 0 ) and ( (Result[Length(Result)] = '0') or (Result[Length(Result)] = '.') ) do
        SetLength(Result, Length(Result) - 1);
    end;

    function MbOrTb(Float: Extended): String;
    begin
      if Float < 1024 then Result:= NumToStr(Float)+' Мб' else
        if Float/1024 < 1024 then Result:= NumToStr(Float/1024)+' Гб' else
          Result:= NumToStr(Float/(1024*1024))+' Тб';
    end;

    procedure DirEditOnChange(Sender: TObject);
    var Drive: String;
    begin
      Drive:= ExtractFileDrive(WizardForm.DirEdit.Text);
      GetSpaceOnDisk(Drive, True, FreeMB, TotalMB);
      TotalSpaceLabel.Caption:= 'Всего места на диске: '+MbOrTb(TotalMB);
      FreeSpaceLabel.Caption:= 'Доступно места на диске: '+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
      InstallSpacelabel.Caption:= 'Требуется места для установки: '+MbOrTb({#NeedInstallSize});
      NeedSpaceLabel.Caption:= 'Требуется места на диске: '+MbOrTb({#NeedSize});
      WizardForm.NextButton.Enabled:= (FreeMB>{#NeedInstallSize})and(FreeMB>{#NeedSize});
    end;

    procedure MyRadioProc(Sender: TObject);
    var
      i: Integer;
    begin
    if TNewRadioButton(Sender) = MyRadioBox[1] then
      for i:=0 to 3 do begin
        MyCheckBox[i].Checked:=False;
        MyCheckBox[i].Enabled:=False;
        Image[1].Show;
      end else
      for i:=0 to 3 do begin
        if (i = 0) or (i = 1) then MyCheckBox[i].Checked:=True;
        MyCheckBox[i].Enabled:=True;
        Image[1].Hide;
      end;
    end;

    procedure InitializeWizard;
    var
      i: Integer;
    begin
    with WizardForm do begin
      LicenseLabel1.Hide;
      SelectDirBrowseLabel.Hide;
      LicenseAcceptedRadio.Hide;
      LicenseNotAcceptedRadio.Hide;
      LicenseMemo.SetBounds(ScaleX(0), ScaleY(0), ScaleX(417), ScaleY(228));
      MyPage:=CreateCustomPage(wpLicense, SetupMessage(msgWizardSelectComponents), SetupMessage(msgSelectComponentsDesc));
      //
      for i:=0 to 1 do begin
        Image[i]:=TBitmapImage.Create(nil);
        with Image[i] do begin
          SetBounds(ScaleX(236), ScaleY(16), ScaleX(180), ScaleY(180));
          ExtractTemporaryFile(IntToStr(i)+'.bmp');
          Bitmap.LoadFromFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'));
          DelayDeleteFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'), 1);
          Parent:=MyPage.Surface;
          if i = 1 then Hide;
        end;
      end;
      //
      MyGroupBox[0]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[0] do begin
        SetBounds(ScaleX(0), ScaleY(0), ScaleX(230), ScaleY(65));
        Caption:=CustomMessage('Group1');
        Parent:=MyPage.Surface;
      end;

      MyGroupBox[1]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[1] do begin
        SetBounds(ScaleX(0), ScaleY(114), ScaleX(230), ScaleY(106));
        Caption:=CustomMessage('Group2');
        Parent:=MyPage.Surface;
      end;

      MyGroupBox[2]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[2] do begin
        SetBounds(ScaleX(0), ScaleY(50), ScaleX(410), ScaleY(60));
        Caption:=SetupMessage(msgWizardSelectDir)+':';
        Parent:=WizardForm.SelectDirPage;
      end;
      //
      for i:=0 to 1 do begin
        MyRadioBox[i]:=TNewRadioButton.Create(nil);
        with MyRadioBox[i] do begin
          SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
          Caption:=CustomMessage('Radio'+IntToStr(i));
          if i = 0 then Checked:=True;
          Parent:=MyGroupBox[0];
          OnClick:=@MyRadioProc;
        end;
      end;

      for i:=0 to 3 do begin
        MyCheckBox[i]:=TNewCheckBox.Create(nil);
        with MyCheckBox[i] do begin
          SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
          Caption:=CustomMessage('Check'+IntToStr(i));
          if (i = 0) or (i = 1) then Checked:=True;
          Parent:=MyGroupBox[1];
        end;
      end;
      //
      TotalSpaceLabel:=TLabel.Create(WizardForm);
      TotalSpaceLabel.AutoSize:= False;
      TotalSpaceLabel.SetBounds(ScaleX(0), ScaleY(125), ScaleX(300), ScaleY(20));
      TotalSpaceLabel.Parent:=SelectDirpage;

      FreeSpaceLabel:=TLabel.Create(WizardForm);
      FreeSpaceLabel.AutoSize:=False;
      FreeSpaceLabel.SetBounds(ScaleX(0), ScaleY(145), ScaleX(300), ScaleY(20));
      FreeSpaceLabel.Parent:=SelectDirpage;

      InstallSpacelabel:=TLabel.Create(WizardForm);
      InstallSpacelabel.AutoSize:=False;
      InstallSpacelabel.SetBounds(ScaleX(0), ScaleY(165), ScaleX(300), ScaleY(20));
      InstallSpacelabel.Parent:=SelectDirpage;

      NeedSpaceLabel:=TLabel.Create(WizardForm);
      NeedSpaceLabel.AutoSize:=False;
      NeedSpaceLabel.SetBounds(ScaleX(0), ScaleY(185), ScaleX(300), ScaleY(20));
      NeedSpaceLabel.Parent:=SelectDirpage;

      DirEdit.OnChange:=@DirEditOnChange;

      DirEdit.Parent:=MyGroupBox[2];
      DirEdit.SetBounds(ScaleX(10), ScaleY(20), ScaleX(300), ScaleY(21));
      DirBrowseButton.Parent:=MyGroupBox[2];
      DirBrowseButton.SetBounds(ScaleX(320), ScaleY(19), ScaleX(75), ScaleY(23));
     end;
    end;

    procedure CurPageChanged(CurPageID: Integer);
    begin
    case CurPageID of
      wpLicense: if not WizardForm.LicenseAcceptedRadio.Checked then WizardForm.LicenseAcceptedRadio.Checked:=True;
      wpSelectDir: if WizardForm.NextButton.Caption <> SetupMessage(msgButtonInstall) then begin
        WizardForm.NextButton.Caption:=SetupMessage(msgButtonInstall);
        DirEditOnChange(nil);
      end;
     end;
    end;
     

    Вложения:

    • Exp.7z
      Размер файла:
      13,6 КБ
      Просмотров:
      9
  3. Новичок

    Регистрация:
    1 дек 2018
    Сообщения:
    6
    Симпатии:
    0
    Пол:
    Мужской
    Nemko, Thanks
    1. Please mix 2 page in your code to 1 page in my file. (like Image attached)
    2. Change header Page to Everything is Ready for installation
    3. Add Repack By Thebig
    4. remove at least 1.7 MB of free... and Add only 3 line (Total disk space,Available disk space,Required disk space).
     

    Вложения:

    • 2.JPG
      2.JPG
      Размер файла:
      219,3 КБ
      Просмотров:
      32
  4. Ветеран Супер модератор

    Регистрация:
    5 мар 2016
    Сообщения:
    383
    Симпатии:
    405
    Пол:
    Мужской
    magsoud, replace with this code:

    Код (Inno):
    #define NeedSize 4380
    #define NeedInstallSize 7890

    [Setup]
    AppVersion=1.5
    AppName=Smart Defrag Pro
    DefaultDirName={sd}\Smart Defrag Pro
    LicenseFile=ReadMe.txt

    [Files]
    DestName: "0.bmp"; Source: "0.bmp"; Flags: dontcopy solidbreak
    DestName: "1.bmp"; Source: "1.bmp"; Flags: dontcopy solidbreak

    [Languages]
    Name: en; MessagesFile: compiler:Languages\English.isl
    Name: ru; MessagesFile: compiler:Languages\Russian.isl

    [CustomMessages]
    en.Group1=Select mode:
    ru.Group1=Выберете режим:

    en.Group2=Additional icons:
    ru.Group2=Дополнительны значки:

    en.Select1=Everything is Ready for installation
    ru.Select1=Все готово для установки

    en.Select2=Setup is ready to install Smart Defrag Pro on your computer.
    ru.Select2=Программа готова к установке Smart Defrag Pro на компьютер.

    en.Radio0=Install Smart Defrag Pro
    ru.Radio0=Установить Smart Defrag Pro

    en.Radio1=Unpacking the Portable Version
    ru.Radio1=Распаковать Portable версию

    en.Check0=Create a desctop icon
    ru.Check0=Создать ярлык на Рабочем столе

    en.Check1=Create a Quick Launch icon
    ru.Check1=Ярлык на Панели быстрого запуска

    en.Check2=Create a taskbar icon
    ru.Check2=Создать ярлык в панели задач

    en.Check3=Start with Windows
    ru.Check3=Запускать с Windows

    en.TotalSpaceLabel=Total disk space:
    ru.TotalSpaceLabel=Всего места на диске:

    en.FreeSpaceLabel=Available disk space:
    ru.FreeSpaceLabel=Доступно места на диске:

    en.NeedSpaceLabel=Disk space required:
    ru.NeedSpaceLabel=Требуется места на диске:

    en.MB_Message= Mb.
    ru.MB_Message= Мб.

    en.GB_Message= Gb.
    ru.GB_Message= Гб.

    en.TB_Message= Tb.
    ru.TB_Message= Тб.

    [Code]
    var
      MyPage: TWizardPage;
      Image: array[0..3] of TBitmapImage;
      MyGroupBox: array[0..2] of TNewGroupBox;
      MyRadioBox: array[0..1] of TNewRadioButton;
      MyCheckBox: array[0..3] of TNewCheckBox;

      TotalSpaceLabel, FreeSpaceLabel, NeedSpacelabel, Logo: TLabel;
      FreeMB, TotalMB: Cardinal;

    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)+CustomMessage('MB_Message') else
       if Float/1024<1024 then Result:=NumToStr(Float/1024)+CustomMessage('GB_Message') else
        Result:=NumToStr(Float/(1024*1024))+CustomMessage('TB_Message');
    end;

    procedure DirEditOnChange(Sender: TObject);
    var
      FreeMB, TotalMB: Cardinal;
    begin
      case Sender of
        WizardForm.DirEdit: begin
          GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text), True, FreeMB, TotalMB);
          TotalSpaceLabel.Caption:=CustomMessage('TotalSpaceLabel')+' '+MbOrTb(TotalMB);
          FreeSpaceLabel.Caption:=CustomMessage('FreeSpaceLabel')+' '+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
          NeedSpaceLabel.Caption:=CustomMessage('NeedSpaceLabel')+' '+MbOrTb({#NeedSize});
          if (FreeMB>{#NeedSize}) then begin
            WizardForm.NextButton.Enabled:=True; FreeSpaceLabel.Color:=$FFFFFF;
          end else begin
            WizardForm.NextButton.Enabled:=False; FreeSpaceLabel.Color:=$FFFF00;
          end;
        end;
      end;
    end;

    procedure MyRadioProc(Sender: TObject);
    var
      i: Integer;
    begin
    if TNewRadioButton(Sender) = MyRadioBox[1] then
      for i:=0 to 3 do begin
        MyCheckBox[i].Checked:=False;
        MyCheckBox[i].Enabled:=False;
        Image[1].Show;
      end else
      for i:=0 to 3 do begin
        if (i = 0) or (i = 1) then MyCheckBox[i].Checked:=True;
        MyCheckBox[i].Enabled:=True;
        Image[1].Hide;
      end;
    end;

    procedure InitializeWizard;
    var
      i: Integer;
    begin
    with WizardForm do begin
      LicenseLabel1.Hide;
      DiskSpaceLabel.Hide;
      LicenseAcceptedRadio.Hide;
      LicenseNotAcceptedRadio.Hide;
      LicenseMemo.SetBounds(ScaleX(0), ScaleY(0), ScaleX(417), ScaleY(228));
      MyPage:=CreateCustomPage(wpLicense, SetupMessage(msgWizardSelectComponents), SetupMessage(msgSelectComponentsDesc));
      //
      for i:=0 to 1 do begin
        Image[i]:=TBitmapImage.Create(nil);
        with Image[i] do begin
          SetBounds(ScaleX(236), ScaleY(16), ScaleX(180), ScaleY(180));
          ExtractTemporaryFile(IntToStr(i)+'.bmp');
          Bitmap.LoadFromFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'));
          DelayDeleteFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'), 1);
          Parent:=MyPage.Surface;
          if i = 1 then Hide;
        end;
      end;
      //
      MyGroupBox[0]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[0] do begin
        SetBounds(ScaleX(0), ScaleY(0), ScaleX(230), ScaleY(65));
        Caption:=CustomMessage('Group1');
        Parent:=MyPage.Surface;
      end;

      MyGroupBox[1]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[1] do begin
        SetBounds(ScaleX(0), ScaleY(114), ScaleX(230), ScaleY(106));
        Caption:=CustomMessage('Group2');
        Parent:=MyPage.Surface;
      end;

      MyGroupBox[2]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[2] do begin
        SetBounds(ScaleX(0), ScaleY(80), ScaleX(410), ScaleY(60));
        Caption:=SetupMessage(msgWizardSelectDir)+':';
        Parent:=WizardForm.SelectDirPage;
      end;
      //
      for i:=0 to 1 do begin
        MyRadioBox[i]:=TNewRadioButton.Create(nil);
        with MyRadioBox[i] do begin
          SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
          Caption:=CustomMessage('Radio'+IntToStr(i));
          if i = 0 then Checked:=True;
          Parent:=MyGroupBox[0];
          OnClick:=@MyRadioProc;
        end;
      end;

      for i:=0 to 3 do begin
        MyCheckBox[i]:=TNewCheckBox.Create(nil);
        with MyCheckBox[i] do begin
          SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
          Caption:=CustomMessage('Check'+IntToStr(i));
          if (i = 0) or (i = 1) then Checked:=True;
          Parent:=MyGroupBox[1];
        end;
      end;
      //
      TotalSpaceLabel:=TLabel.Create(WizardForm);
      TotalSpaceLabel.AutoSize:= False;
      TotalSpaceLabel.SetBounds(ScaleX(20), ScaleY(165), ScaleX(300), ScaleY(20));
      TotalSpaceLabel.Parent:=SelectDirpage;

      FreeSpaceLabel:=TLabel.Create(WizardForm);
      FreeSpaceLabel.AutoSize:=False;
      FreeSpaceLabel.SetBounds(ScaleX(20), ScaleY(185), ScaleX(300), ScaleY(20));
      FreeSpaceLabel.Parent:=SelectDirpage;

      NeedSpaceLabel:=TLabel.Create(WizardForm);
      NeedSpaceLabel.AutoSize:=False;
      NeedSpaceLabel.SetBounds(ScaleX(20), ScaleY(205), ScaleX(300), ScaleY(20));
      NeedSpaceLabel.Parent:=SelectDirpage;

      Logo:=TLabel.Create(WizardForm);
      Logo.AutoSize:=False;
      Logo.Font.Size:=12;
      Logo.Font.Color:=$820009;
      Logo.Font.Style:=[fsBold, fsItalic];
      Logo.Caption:='Repack By Thebig';
      Logo.SetBounds(ScaleX(10), ScaleY(326), ScaleX(180), ScaleY(25));
      Logo.Parent:=WizardForm;

      DirEdit.OnChange:=@DirEditOnChange;

      DirEdit.Parent:=MyGroupBox[2];
      DirEdit.SetBounds(ScaleX(10), ScaleY(25), ScaleX(300), ScaleY(21));
      DirBrowseButton.Parent:=MyGroupBox[2];
      DirBrowseButton.SetBounds(ScaleX(320), ScaleY(24), ScaleX(75), ScaleY(23));
     end;
    end;

    procedure CurPageChanged(CurPageID: Integer);
    begin
    case CurPageID of
      wpLicense: if not WizardForm.LicenseAcceptedRadio.Checked then WizardForm.LicenseAcceptedRadio.Checked:=True;
      wpSelectDir: if WizardForm.NextButton.Caption <> SetupMessage(msgButtonInstall) then begin
        WizardForm.PageNameLabel.Caption:=CustomMessage('Select1');
        WizardForm.PageDescriptionLabel.Caption:=CustomMessage('Select2');
        WizardForm.NextButton.Caption:=SetupMessage(msgButtonInstall);
        DirEditOnChange(WizardForm.DirEdit);
      end;
     end;
    end;

    function ShouldSkipPage(CurPageID: Integer): Boolean;
    begin
    case CurPageID of
      wpWelcome,MyPage.ID,wpSelectDir,wpInstalling,wpFinished: Result:=False;
      else Result:=True;
     end;
    end;
     
    magsoud нравится это.
  5. Новичок

    Регистрация:
    1 дек 2018
    Сообщения:
    6
    Симпатии:
    0
    Пол:
    Мужской
    Nemko, Very Thanks
    1. I made the code custom for myself.(attached)
    Please Fix this:
    2. Enable Information Page.(1.JPG attached)
    3. Change Ready Page.(3.JPG attached)
    4. Incorrect "Required space for installation"!.(3.JPG attached)
     

    Вложения:

    • 1.JPG
      1.JPG
      Размер файла:
      64,3 КБ
      Просмотров:
      24
    • 3.JPG
      3.JPG
      Размер файла:
      155,1 КБ
      Просмотров:
      24
    • Exp - 2.iss
      Размер файла:
      7,4 КБ
      Просмотров:
      2
  6. Ветеран Супер модератор

    Регистрация:
    5 мар 2016
    Сообщения:
    383
    Симпатии:
    405
    Пол:
    Мужской
    magsoud,

    Код (Inno):
    #define NeedSize 56
    #define NeedInstallSize 7890

    [Setup]
    AppPublisher=Iobit, Inc.
    AppPublisherURL=http://www.iobit.com
    AppName=Smart Defrag Pro 6
    VersionInfoVersion=6.1.5.120
    AppCopyright=Copyright © 2018 Iobit.
    AppVersion=6.1
    DefaultDirName={pf}\Smart Defrag 6
    OutputDir=.\
    OutputBaseFilename=Setup
    Compression=lzma2/ultra64
    InternalCompressLevel=ultra64
    SolidCompression=yes
    DisableWelcomePage=No
    InfoBeforeFile=embedded\InfoBefore.rtf
    WizardImageFile=embedded\WizardImage.bmp
    WizardSmallImageFile=embedded\WizardSmallImage.bmp
    SetupIconFile=embedded\Icon.ico

    [Files]
    DestName: "0.bmp"; Source: "0.bmp"; Flags: dontcopy solidbreak
    DestName: "1.bmp"; Source: "1.bmp"; Flags: dontcopy solidbreak

    [CustomMessages]
    Group1=Select a Mode:
    Group2=Additional icons:
    Select1=Everything is Ready for installation
    Select2=Setup is ready to install Smart Defrag Pro on your computer
    Select3=To continue, click Install. If you would like to select a different folder, click Browse...%n%nClick "Install" to install Smart Defrag Pro

    Radio0=Install Smart Defrag Pro
    Radio1=Unpacking the Portable Version

    Check0=Create a desctop icon
    Check1=Create a Quick Launch icon
    Check2=Create a taskbar icon
    Check3=Start with Windows

    TotalSpaceLabel=Total disk space:
    FreeSpaceLabel=Available disk space:
    NeedSpaceLabel=Required space for installation:

    MB_Message= Mb
    GB_Message= Gb
    TB_Message= Tb

    [Code]
    var
      MyPage: TWizardPage;
      Image: array[0..3] of TBitmapImage;
      MyGroupBox: array[0..2] of TNewGroupBox;
      MyRadioBox: array[0..1] of TNewRadioButton;
      MyCheckBox: array[0..3] of TNewCheckBox;

      TotalSpaceLabel, FreeSpaceLabel, NeedSpacelabel, Logo: TLabel;
      FreeMB, TotalMB: Cardinal;

    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)+CustomMessage('MB_Message') else
       if Float/1024<1024 then Result:=NumToStr(Float/1024)+CustomMessage('GB_Message') else
        Result:=NumToStr(Float/(1024*1024))+CustomMessage('TB_Message');
    end;

    procedure DirEditOnChange(Sender: TObject);
    var
      FreeMB, TotalMB: Cardinal;
    begin
      case Sender of
        WizardForm.DirEdit: begin
          GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text), True, FreeMB, TotalMB);
          TotalSpaceLabel.Caption:=CustomMessage('TotalSpaceLabel')+' '+MbOrTb(TotalMB);
          FreeSpaceLabel.Caption:=CustomMessage('FreeSpaceLabel')+' '+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
          NeedSpaceLabel.Caption:=CustomMessage('NeedSpaceLabel')+' '+MbOrTb({#NeedSize});
          if (FreeMB>{#NeedSize}) then begin
            WizardForm.NextButton.Enabled:=True; FreeSpaceLabel.Color:=$FFFFFF;
          end else begin
            WizardForm.NextButton.Enabled:=False; FreeSpaceLabel.Color:=$FFFF00;
          end;
        end;
      end;
    end;

    procedure MyRadioProc(Sender: TObject);
    var
      i: Integer;
    begin
    if TNewRadioButton(Sender) = MyRadioBox[1] then
      for i:=0 to 3 do begin
        MyCheckBox[i].Checked:=False;
        MyCheckBox[i].Enabled:=False;
        Image[1].Show;
      end else
      for i:=0 to 3 do begin
        if (i = 0) or (i = 1) then MyCheckBox[i].Checked:=True;
        MyCheckBox[i].Enabled:=True;
        Image[1].Hide;
      end;
    end;

    procedure InitializeWizard;
    var
      i: Integer;
    begin
    with WizardForm do begin
      LicenseLabel1.Hide;
      DiskSpaceLabel.Hide;
      SelectDirLabel.Hide;
      SelectDirBitmapImage.Hide;
      LicenseAcceptedRadio.Hide;
      LicenseNotAcceptedRadio.Hide;
      LicenseMemo.SetBounds(ScaleX(0), ScaleY(0), ScaleX(417), ScaleY(228));
      MyPage:=CreateCustomPage(wpInfoBefore, SetupMessage(msgWizardSelectComponents), SetupMessage(msgSelectComponentsDesc));
      //
      for i:=0 to 1 do begin
        Image[i]:=TBitmapImage.Create(nil);
        with Image[i] do begin
          SetBounds(ScaleX(236), ScaleY(16), ScaleX(180), ScaleY(180));
          ExtractTemporaryFile(IntToStr(i)+'.bmp');
          Bitmap.LoadFromFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'));
          DelayDeleteFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'), 1);
          Parent:=MyPage.Surface;
          if i = 1 then Hide;
        end;
      end;
      //
      MyGroupBox[0]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[0] do begin
        SetBounds(ScaleX(0), ScaleY(0), ScaleX(230), ScaleY(65));
        Caption:=CustomMessage('Group1');
        Parent:=MyPage.Surface;
      end;

      MyGroupBox[1]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[1] do begin
        SetBounds(ScaleX(0), ScaleY(114), ScaleX(230), ScaleY(106));
        Caption:=CustomMessage('Group2');
        Parent:=MyPage.Surface;
      end;

      MyGroupBox[2]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[2] do begin
        SetBounds(ScaleX(0), ScaleY(80), ScaleX(410), ScaleY(60));
        Caption:=SetupMessage(msgWizardSelectDir)+':';
        Parent:=WizardForm.SelectDirPage;
      end;
      //
      for i:=0 to 1 do begin
        MyRadioBox[i]:=TNewRadioButton.Create(nil);
        with MyRadioBox[i] do begin
          SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
          Caption:=CustomMessage('Radio'+IntToStr(i));
          if i = 0 then Checked:=True;
          Parent:=MyGroupBox[0];
          OnClick:=@MyRadioProc;
        end;
      end;

      for i:=0 to 3 do begin
        MyCheckBox[i]:=TNewCheckBox.Create(nil);
        with MyCheckBox[i] do begin
          SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
          Caption:=CustomMessage('Check'+IntToStr(i));
          if (i = 0) or (i = 1) then Checked:=True;
          Parent:=MyGroupBox[1];
        end;
      end;
      //
      TotalSpaceLabel:=TLabel.Create(WizardForm);
      TotalSpaceLabel.AutoSize:= False;
      TotalSpaceLabel.SetBounds(ScaleX(20), ScaleY(165), ScaleX(300), ScaleY(20));
      TotalSpaceLabel.Parent:=SelectDirpage;

      FreeSpaceLabel:=TLabel.Create(WizardForm);
      FreeSpaceLabel.AutoSize:=False;
      FreeSpaceLabel.SetBounds(ScaleX(20), ScaleY(185), ScaleX(300), ScaleY(20));
      FreeSpaceLabel.Parent:=SelectDirpage;

      NeedSpaceLabel:=TLabel.Create(WizardForm);
      NeedSpaceLabel.AutoSize:=False;
      NeedSpaceLabel.SetBounds(ScaleX(20), ScaleY(205), ScaleX(300), ScaleY(20));
      NeedSpaceLabel.Parent:=SelectDirpage;

      Logo:=TLabel.Create(WizardForm);
      Logo.AutoSize:=False;
      Logo.Font.Size:=12;
      Logo.Font.Color:=$820009;
      Logo.Font.Style:=[fsBold, fsItalic];
      Logo.Caption:='Repack By Magsoud';
      Logo.SetBounds(ScaleX(10), ScaleY(326), ScaleX(180) , ScaleY(25));
      Logo.Parent:= WizardForm;

      DirEdit. OnChange := @ DirEditOnChange;

      DirEdit.Parent:=MyGroupBox[2];
      DirEdit. SetBounds (ScaleX(10), ScaleY(25), ScaleX(300), ScaleY(21));
      DirBrowseButton.Parent:=MyGroupBox[2];
      DirBrowseButton.SetBounds(ScaleX(320), ScaleY(24), ScaleX(75), ScaleY(23));
      SelectDirBrowseLabel.SetBounds(ScaleX(0), ScaleY(20), ScaleX(417), ScaleY(42));
      SelectDirBrowseLabel.Caption:=CustomMessage('Select3');
     end;
    end;

    procedure CurPageChanged(CurPageID: Integer);
    begin
    case CurPageID of
      wpLicense: if not WizardForm.LicenseAcceptedRadio.Checked then WizardForm.LicenseAcceptedRadio.Checked:=True;
      wpSelectDir: if WizardForm.NextButton.Caption <> SetupMessage(msgButtonInstall) then begin
        WizardForm.PageNameLabel.Caption:=CustomMessage('Select1');
        WizardForm.PageDescriptionLabel.Caption:=CustomMessage('Select2');
        WizardForm.NextButton.Caption:=SetupMessage(msgButtonInstall);
        DirEditOnChange(WizardForm.DirEdit);
      end;
     end;
    end;

    function ShouldSkipPage(CurPageID: Integer): Boolean;
    begin
    case CurPageID of
      wpWelcome,wpInfoBefore,MyPage.ID,wpSelectDir,wpInstalling,wpFinished: Result:=False;
      else Result:=True;
     end;
    end;
     
    magsoud нравится это.
  7. Новичок

    Регистрация:
    1 дек 2018
    Сообщения:
    6
    Симпатии:
    0
    Пол:
    Мужской
    Nemko, Thanks
    1. Please Dleate
    (#define NeedSize 56
    #define NeedInstallSize 7890) code and
    Replace with "At least ??? MB of free disk space is required." Code. (The original code correctly shows)1.JPG

    2. Add this reg code for "start with windows"2.JPG
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
    "Smart Defrag"="\"C:\\Program Files (x86)\\Smart Defrag 6\\SmartDefrag.exe\""
     

    Вложения:

    • 1.JPG
      1.JPG
      Размер файла:
      154,8 КБ
      Просмотров:
      22
    • 2.JPG
      2.JPG
      Размер файла:
      48,1 КБ
      Просмотров:
      24
  8. Ветеран Супер модератор

    Регистрация:
    5 мар 2016
    Сообщения:
    383
    Симпатии:
    405
    Пол:
    Мужской
    magsoud, like so:

    Код (Inno):
    #define NeedSize 56
    #define NeedInstallSize 7890

    [Setup]
    AppPublisher=Iobit, Inc.
    AppPublisherURL=http://www.iobit.com
    AppName=Smart Defrag Pro 6
    VersionInfoVersion=6.1.5.120
    AppCopyright=Copyright © 2018 Iobit.
    AppVersion=6.1
    DefaultDirName={pf}\Smart Defrag 6
    OutputDir=.\
    OutputBaseFilename=Setup
    Compression=lzma2/ultra64
    InternalCompressLevel=ultra64
    SolidCompression=yes
    DisableWelcomePage=No
    InfoBeforeFile=embedded\InfoBefore.rtf
    WizardImageFile=embedded\WizardImage.bmp
    WizardSmallImageFile=embedded\WizardSmallImage.bmp
    SetupIconFile=embedded\Icon.ico

    [Files]
    DestName: "0.bmp"; Source: "0.bmp"; Flags: dontcopy solidbreak
    DestName: "1.bmp"; Source: "1.bmp"; Flags: dontcopy solidbreak

    [Registry]
    Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Run; ValueType: String; ValueName: Smart Defrag; ValueData: "{app}\SmartDefrag.exe"; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: CheckBoxChecked;


    [CustomMessages]
    Group1=Select a Mode:
    Group2=Additional icons:
    Select1=Everything is Ready for installation
    Select2=Setup is ready to install Smart Defrag Pro on your computer
    Select3=To continue, click Install. If you would like to select a different folder, click Browse...%n%nClick "Install" to install Smart Defrag Pro

    Radio0=Install Smart Defrag Pro
    Radio1=Unpacking the Portable Version

    Check0=Create a desctop icon
    Check1=Create a Quick Launch icon
    Check2=Create a taskbar icon
    Check3=Start with Windows

    TotalSpaceLabel=Total disk space:
    FreeSpaceLabel=Available disk space:
    NeedSpaceLabel1=At least
    NeedSpaceLabel2= of free disk space is required.

    MB_Message= Mb
    GB_Message= Gb
    TB_Message= Tb

    [Code]
    var
      MyPage: TWizardPage;
      Image: array[0..3] of TBitmapImage;
      MyGroupBox: array[0..2] of TNewGroupBox;
      MyRadioBox: array[0..1] of TNewRadioButton;
      MyCheckBox: array[0..3] of TNewCheckBox;

      TotalSpaceLabel, FreeSpaceLabel, NeedSpacelabel, Logo: TLabel;
      FreeMB, TotalMB: Cardinal;

    function CheckBoxChecked: Boolean;
    begin
      Result:=MyCheckBox[3].Checked;
    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)+CustomMessage('MB_Message') else
       if Float/1024<1024 then Result:=NumToStr(Float/1024)+CustomMessage('GB_Message') else
        Result:=NumToStr(Float/(1024*1024))+CustomMessage('TB_Message');
    end;

    procedure DirEditOnChange(Sender: TObject);
    var
      FreeMB, TotalMB: Cardinal;
    begin
      case Sender of
        WizardForm.DirEdit: begin
          GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text), True, FreeMB, TotalMB);
          TotalSpaceLabel.Caption:=CustomMessage('TotalSpaceLabel')+' '+MbOrTb(TotalMB);
          FreeSpaceLabel.Caption:=CustomMessage('FreeSpaceLabel')+' '+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
          NeedSpaceLabel.Caption:=CustomMessage('NeedSpaceLabel1')+' '+Uppercase(MbOrTb({#NeedSize}))+CustomMessage('NeedSpaceLabel2');
          if (FreeMB>{#NeedSize}) then begin
            WizardForm.NextButton.Enabled:=True; FreeSpaceLabel.Color:=$FFFFFF;
          end else begin
            WizardForm.NextButton.Enabled:=False; FreeSpaceLabel.Color:=$FFFF00;
          end;
        end;
      end;
    end;

    procedure MyRadioProc(Sender: TObject);
    var
      i: Integer;
    begin
    if TNewRadioButton(Sender) = MyRadioBox[1] then
      for i:=0 to 3 do begin
        MyCheckBox[i].Checked:=False;
        MyCheckBox[i].Enabled:=False;
        Image[1].Show;
      end else
      for i:=0 to 3 do begin
        if (i = 0) or (i = 1) then MyCheckBox[i].Checked:=True;
        MyCheckBox[i].Enabled:=True;
        Image[1].Hide;
      end;
    end;

    procedure InitializeWizard;
    var
      i: Integer;
    begin
    with WizardForm do begin
      LicenseLabel1.Hide;
      DiskSpaceLabel.Hide;
      SelectDirLabel.Hide;
      SelectDirBitmapImage.Hide;
      LicenseAcceptedRadio.Hide;
      LicenseNotAcceptedRadio.Hide;
      LicenseMemo.SetBounds(ScaleX(0), ScaleY(0), ScaleX(417), ScaleY(228));
      MyPage:=CreateCustomPage(wpInfoBefore, SetupMessage(msgWizardSelectComponents), SetupMessage(msgSelectComponentsDesc));
      //
      for i:=0 to 1 do begin
        Image[i]:=TBitmapImage.Create(nil);
        with Image[i] do begin
          SetBounds(ScaleX(236), ScaleY(16), ScaleX(180), ScaleY(180));
          ExtractTemporaryFile(IntToStr(i)+'.bmp');
          Bitmap.LoadFromFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'));
          DelayDeleteFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'), 1);
          Parent:=MyPage.Surface;
          if i = 1 then Hide;
        end;
      end;
      //
      MyGroupBox[0]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[0] do begin
        SetBounds(ScaleX(0), ScaleY(0), ScaleX(230), ScaleY(65));
        Caption:=CustomMessage('Group1');
        Parent:=MyPage.Surface;
      end;

      MyGroupBox[1]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[1] do begin
        SetBounds(ScaleX(0), ScaleY(114), ScaleX(230), ScaleY(106));
        Caption:=CustomMessage('Group2');
        Parent:=MyPage.Surface;
      end;

      MyGroupBox[2]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[2] do begin
        SetBounds(ScaleX(0), ScaleY(80), ScaleX(410), ScaleY(60));
        Caption:=SetupMessage(msgWizardSelectDir)+':';
        Parent:=WizardForm.SelectDirPage;
      end;
      //
      for i:=0 to 1 do begin
        MyRadioBox[i]:=TNewRadioButton.Create(nil);
        with MyRadioBox[i] do begin
          SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
          Caption:=CustomMessage('Radio'+IntToStr(i));
          if i = 0 then Checked:=True;
          Parent:=MyGroupBox[0];
          OnClick:=@MyRadioProc;
        end;
      end;

      for i:=0 to 3 do begin
        MyCheckBox[i]:=TNewCheckBox.Create(nil);
        with MyCheckBox[i] do begin
          SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
          Caption:=CustomMessage('Check'+IntToStr(i));
          if (i = 0) or (i = 1) then Checked:=True;
          Parent:=MyGroupBox[1];
        end;
      end;
      //
      TotalSpaceLabel:=TLabel.Create(WizardForm);
      TotalSpaceLabel.AutoSize:= False;
      TotalSpaceLabel.SetBounds(ScaleX(20), ScaleY(165), ScaleX(300), ScaleY(20));
      TotalSpaceLabel.Parent:=SelectDirpage;

      FreeSpaceLabel:=TLabel.Create(WizardForm);
      FreeSpaceLabel.AutoSize:=False;
      FreeSpaceLabel.SetBounds(ScaleX(20), ScaleY(185), ScaleX(300), ScaleY(20));
      FreeSpaceLabel.Parent:=SelectDirpage;

      NeedSpaceLabel:=TLabel.Create(WizardForm);
      NeedSpaceLabel.AutoSize:=False;
      NeedSpaceLabel.SetBounds(ScaleX(20), ScaleY(205), ScaleX(300), ScaleY(20));
      NeedSpaceLabel.Parent:=SelectDirpage;

      Logo:=TLabel.Create(WizardForm);
      Logo.AutoSize:=False;
      Logo.Font.Size:=12;
      Logo.Font.Color:=$820009;
      Logo.Font.Style:=[fsBold, fsItalic];
      Logo.Caption:='Repack By Magsoud';
      Logo.SetBounds(ScaleX(10), ScaleY(326), ScaleX(180) , ScaleY(25));
      Logo.Parent:= WizardForm;

      DirEdit. OnChange := @ DirEditOnChange;

      DirEdit.Parent:=MyGroupBox[2];
      DirEdit. SetBounds (ScaleX(10), ScaleY(25), ScaleX(300), ScaleY(21));
      DirBrowseButton.Parent:=MyGroupBox[2];
      DirBrowseButton.SetBounds(ScaleX(320), ScaleY(24), ScaleX(75), ScaleY(23));
      SelectDirBrowseLabel.SetBounds(ScaleX(0), ScaleY(20), ScaleX(417), ScaleY(42));
      SelectDirBrowseLabel.Caption:=CustomMessage('Select3');
     end;
    end;

    procedure CurPageChanged(CurPageID: Integer);
    begin
    case CurPageID of
      wpLicense: if not WizardForm.LicenseAcceptedRadio.Checked then WizardForm.LicenseAcceptedRadio.Checked:=True;
      wpSelectDir: if WizardForm.NextButton.Caption <> SetupMessage(msgButtonInstall) then begin
        WizardForm.PageNameLabel.Caption:=CustomMessage('Select1');
        WizardForm.PageDescriptionLabel.Caption:=CustomMessage('Select2');
        WizardForm.NextButton.Caption:=SetupMessage(msgButtonInstall);
        DirEditOnChange(WizardForm.DirEdit);
      end;
     end;
    end;

    function ShouldSkipPage(CurPageID: Integer): Boolean;
    begin
    case CurPageID of
      wpWelcome,wpInfoBefore,MyPage.ID,wpSelectDir,wpInstalling,wpFinished: Result:=False;
      else Result:=True;
     end;
    end;
     
  9. Новичок

    Регистрация:
    1 дек 2018
    Сообщения:
    6
    Симпатии:
    0
    Пол:
    Мужской
    Nemko, Thanks
    I want to automatically detect the file size myself.
    For example, a file is 5 MB or 400 MB or ...
    original inno setup Smartly detects in SelectDirPage!
     

    Вложения:

    • 1.JPG
      1.JPG
      Размер файла:
      84,8 КБ
      Просмотров:
      14
  10. Ветеран Супер модератор

    Регистрация:
    5 мар 2016
    Сообщения:
    383
    Симпатии:
    405
    Пол:
    Мужской
    magsoud, can use FileSize for Setup.exe:
    Код (Inno):
    [Setup]
    AppPublisher=Iobit, Inc.
    AppPublisherURL=http://www.iobit.com
    AppName=Smart Defrag Pro 6
    VersionInfoVersion=6.1.5.120
    AppCopyright=Copyright © 2018 Iobit.
    AppVersion=6.1
    DefaultDirName={pf}\Smart Defrag 6
    OutputDir=.\
    OutputBaseFilename=Setup
    Compression=lzma2/ultra64
    InternalCompressLevel=ultra64
    SolidCompression=yes
    DisableWelcomePage=No
    InfoBeforeFile=embedded\InfoBefore.rtf
    WizardImageFile=embedded\WizardImage.bmp
    WizardSmallImageFile=embedded\WizardSmallImage.bmp
    SetupIconFile=embedded\Icon.ico

    [Files]
    DestName: "0.bmp"; Source: "0.bmp"; Flags: dontcopy solidbreak
    DestName: "1.bmp"; Source: "1.bmp"; Flags: dontcopy solidbreak

    [Registry]
    Root: HKLM; SubKey: SOFTWARE\Microsoft\Windows\CurrentVersion\Run; ValueType: String; ValueName: Smart Defrag; ValueData: "{app}\SmartDefrag.exe"; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: CheckBoxChecked;


    [CustomMessages]
    Group1=Select a Mode:
    Group2=Additional icons:
    Select1=Everything is Ready for installation
    Select2=Setup is ready to install Smart Defrag Pro on your computer
    Select3=To continue, click Install. If you would like to select a different folder, click Browse...%n%nClick "Install" to install Smart Defrag Pro

    Radio0=Install Smart Defrag Pro
    Radio1=Unpacking the Portable Version

    Check0=Create a desctop icon
    Check1=Create a Quick Launch icon
    Check2=Create a taskbar icon
    Check3=Start with Windows

    TotalSpaceLabel=Total disk space:
    FreeSpaceLabel=Available disk space:
    NeedSpaceLabel1=At least
    NeedSpaceLabel2= of free disk space is required.

    MB_Message= Mb
    GB_Message= Gb
    TB_Message= Tb

    [Code]
    var
      MyPage: TWizardPage;
      ApplicationSize: Integer;
      Image: array[0..3] of TBitmapImage;
      MyGroupBox: array[0..2] of TNewGroupBox;
      MyRadioBox: array[0..1] of TNewRadioButton;
      MyCheckBox: array[0..3] of TNewCheckBox;

      TotalSpaceLabel, FreeSpaceLabel, NeedSpacelabel, Logo: TLabel;
      FreeMB, TotalMB: Cardinal;

    function CheckBoxChecked: Boolean;
    begin
      Result:=MyCheckBox[3].Checked;
    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)+CustomMessage('MB_Message') else
       if Float/1024<1024 then Result:=NumToStr(Float/1024)+CustomMessage('GB_Message') else
        Result:=NumToStr(Float/(1024*1024))+CustomMessage('TB_Message');
    end;

    procedure DirEditOnChange(Sender: TObject);
    var
      FreeMB, TotalMB: Cardinal;
      tmp2: Integer;
      tmp: Extended;
    begin
      case Sender of
        WizardForm.DirEdit: begin
          GetSpaceOnDisk(ExtractFileDrive(WizardForm.DirEdit.Text), True, FreeMB, TotalMB);
          TotalSpaceLabel.Caption:=CustomMessage('TotalSpaceLabel')+' '+MbOrTb(TotalMB);
          FreeSpaceLabel.Caption:=CustomMessage('FreeSpaceLabel')+' '+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
          FileSize(ExpandConstant('{src}\')+'{#SetupSetting("OutputBaseFilename")}'+'.exe', ApplicationSize);
          if ApplicationSize > 1048576 then begin
            tmp:=ApplicationSize/1048576; tmp2:=Trunc(ApplicationSize/1048576);
          end else begin
            tmp:=1; tmp2:=1;
          end;
          NeedSpaceLabel.Caption:=CustomMessage('NeedSpaceLabel1')+' '+Uppercase(MbOrTb(tmp))+CustomMessage('NeedSpaceLabel2');
          if (FreeMB > tmp2) then begin
            WizardForm.NextButton.Enabled:=True; FreeSpaceLabel.Font.Color:=$FFFFFF;
          end else begin
            WizardForm.NextButton.Enabled:=False; FreeSpaceLabel.Font.Color:=clRed;
          end;
        end;
      end;
    end;

    procedure MyRadioProc(Sender: TObject);
    var
      i: Integer;
    begin
    if TNewRadioButton(Sender) = MyRadioBox[1] then
      for i:=0 to 3 do begin
        MyCheckBox[i].Checked:=False;
        MyCheckBox[i].Enabled:=False;
        Image[1].Show;
      end else
      for i:=0 to 3 do begin
        if (i = 0) or (i = 1) then MyCheckBox[i].Checked:=True;
        MyCheckBox[i].Enabled:=True;
        Image[1].Hide;
      end;
    end;

    procedure InitializeWizard;
    var
      i: Integer;
    begin
    with WizardForm do begin
      LicenseLabel1.Hide;
      DiskSpaceLabel.Hide;
      SelectDirLabel.Hide;
      SelectDirBitmapImage.Hide;
      LicenseAcceptedRadio.Hide;
      LicenseNotAcceptedRadio.Hide;
      LicenseMemo.SetBounds(ScaleX(0), ScaleY(0), ScaleX(417), ScaleY(228));
      MyPage:=CreateCustomPage(wpInfoBefore, SetupMessage(msgWizardSelectComponents), SetupMessage(msgSelectComponentsDesc));
      //
      for i:=0 to 1 do begin
        Image[i]:=TBitmapImage.Create(nil);
        with Image[i] do begin
          SetBounds(ScaleX(236), ScaleY(16), ScaleX(180), ScaleY(180));
          ExtractTemporaryFile(IntToStr(i)+'.bmp');
          Bitmap.LoadFromFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'));
          DelayDeleteFile(ExpandConstant('{tmp}\'+IntToStr(i)+'.bmp'), 1);
          Parent:=MyPage.Surface;
          if i = 1 then Hide;
        end;
      end;
      //
      MyGroupBox[0]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[0] do begin
        SetBounds(ScaleX(0), ScaleY(0), ScaleX(230), ScaleY(65));
        Caption:=CustomMessage('Group1');
        Parent:=MyPage.Surface;
      end;

      MyGroupBox[1]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[1] do begin
        SetBounds(ScaleX(0), ScaleY(114), ScaleX(230), ScaleY(106));
        Caption:=CustomMessage('Group2');
        Parent:=MyPage.Surface;
      end;

      MyGroupBox[2]:=TNewGroupBox.Create(WizardForm);
      with MyGroupBox[2] do begin
        SetBounds(ScaleX(0), ScaleY(80), ScaleX(410), ScaleY(60));
        Caption:=SetupMessage(msgWizardSelectDir)+':';
        Parent:=WizardForm.SelectDirPage;
      end;
      //
      for i:=0 to 1 do begin
        MyRadioBox[i]:=TNewRadioButton.Create(nil);
        with MyRadioBox[i] do begin
          SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
          Caption:=CustomMessage('Radio'+IntToStr(i));
          if i = 0 then Checked:=True;
          Parent:=MyGroupBox[0];
          OnClick:=@MyRadioProc;
        end;
      end;

      for i:=0 to 3 do begin
        MyCheckBox[i]:=TNewCheckBox.Create(nil);
        with MyCheckBox[i] do begin
          SetBounds(ScaleX(10), ScaleY(20+20*i), ScaleX(400), ScaleY(17));
          Caption:=CustomMessage('Check'+IntToStr(i));
          if (i = 0) or (i = 1) then Checked:=True;
          Parent:=MyGroupBox[1];
        end;
      end;
      //
      TotalSpaceLabel:=TLabel.Create(WizardForm);
      TotalSpaceLabel.AutoSize:= False;
      TotalSpaceLabel.SetBounds(ScaleX(20), ScaleY(165), ScaleX(300), ScaleY(20));
      TotalSpaceLabel.Parent:=SelectDirpage;

      FreeSpaceLabel:=TLabel.Create(WizardForm);
      FreeSpaceLabel.AutoSize:=False;
      FreeSpaceLabel.SetBounds(ScaleX(20), ScaleY(185), ScaleX(300), ScaleY(20));
      FreeSpaceLabel.Parent:=SelectDirpage;

      NeedSpaceLabel:=TLabel.Create(WizardForm);
      NeedSpaceLabel.AutoSize:=False;
      NeedSpaceLabel.SetBounds(ScaleX(20), ScaleY(205), ScaleX(300), ScaleY(20));
      NeedSpaceLabel.Parent:=SelectDirpage;

      Logo:=TLabel.Create(WizardForm);
      Logo.AutoSize:=False;
      Logo.Font.Size:=12;
      Logo.Font.Color:=$820009;
      Logo.Font.Style:=[fsBold, fsItalic];
      Logo.Caption:='Repack By Magsoud';
      Logo.SetBounds(ScaleX(10), ScaleY(326), ScaleX(180) , ScaleY(25));
      Logo.Parent:= WizardForm;

      DirEdit. OnChange := @ DirEditOnChange;

      DirEdit.Parent:=MyGroupBox[2];
      DirEdit. SetBounds (ScaleX(10), ScaleY(25), ScaleX(300), ScaleY(21));
      DirBrowseButton.Parent:=MyGroupBox[2];
      DirBrowseButton.SetBounds(ScaleX(320), ScaleY(24), ScaleX(75), ScaleY(23));
      SelectDirBrowseLabel.SetBounds(ScaleX(0), ScaleY(20), ScaleX(417), ScaleY(42));
      SelectDirBrowseLabel.Caption:=CustomMessage('Select3');
     end;
    end;

    procedure CurPageChanged(CurPageID: Integer);
    begin
    case CurPageID of
      wpLicense: if not WizardForm.LicenseAcceptedRadio.Checked then WizardForm.LicenseAcceptedRadio.Checked:=True;
      wpSelectDir: if WizardForm.NextButton.Caption <> SetupMessage(msgButtonInstall) then begin
        WizardForm.PageNameLabel.Caption:=CustomMessage('Select1');
        WizardForm.PageDescriptionLabel.Caption:=CustomMessage('Select2');
        WizardForm.NextButton.Caption:=SetupMessage(msgButtonInstall);
        DirEditOnChange(WizardForm.DirEdit);
      end;
     end;
    end;

    function ShouldSkipPage(CurPageID: Integer): Boolean;
    begin
    case CurPageID of
      wpWelcome,wpInfoBefore,MyPage.ID,wpSelectDir,wpInstalling,wpFinished: Result:=False;
      else Result:=True;
     end;
    end;
     
    magsoud нравится это.
  11. Old Men Проверенный

    Регистрация:
    17 июн 2011
    Сообщения:
    456
    Симпатии:
    429
    Пол:
    Мужской
    Nemko, а не кажется тебе, что наш иностранный друг несколько обнаглел? Вообще-то такое в заказах и не бесплатно делают.
     
    Nemko, Косой и SBalykov нравится это.
  12. Ветеран

    Регистрация:
    31 мар 2015
    Сообщения:
    318
    Симпатии:
    163
    Пол:
    Мужской
    Ага.
    Нашел добрую душу, сел и поехал, да еще и ножками дрыгает...
     
    Косой нравится это.
  13. Новичок

    Регистрация:
    1 дек 2018
    Сообщения:
    6
    Симпатии:
    0
    Пол:
    Мужской

    Вложения:

    • test.7z
      Размер файла:
      2,5 МБ
      Просмотров:
      9
  14. Старожил

    Регистрация:
    25 июн 2014
    Сообщения:
    22
    Симпатии:
    4
    Пол:
    Мужской
    upload_2018-12-9_13-25-21.png
     

Поделиться этой страницей