Вопрос

I've only been experimenting with Inno for a few days so forgive my lack of knowledge!

In my Setup script I've added a TInputOptionWizardPage with two options:

  1. Install everything
  2. Only install system files (DLLs etc)

If the user selects the second option, how do I exclude certain files from installing and can I also prevent an icon from being created?

Это было полезно?

Решение

You can write a Check function for conditional installing of certain files. In this function you can decide whether the file should be installed or not depending on the state of your radio buttons. Here is example script which shows, how to conditionally create an icon if the first radio button is selected on the custom options page:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultGroupName=My Program
DefaultDirName={pf}\My Program

[Icons]
Name: "{group}\My Program"; Filename: "calc.exe"; WorkingDir: "{app}"; Check: ShouldInstallIcon

[Code]
var
  MyOptionsPage: TInputOptionWizardPage;

procedure InitializeWizard;
begin
  MyOptionsPage := CreateInputOptionPage(wpWelcome, 'Caption', 'Description',
    'SubCaption', True, False);
  MyOptionsPage.Add('Install icon');
  MyOptionsPage.Add('Do not install icon');
  MyOptionsPage.Values[0] := True;
end;

function ShouldInstallIcon: Boolean;
begin
  // here write a condition, which if you return True will process an entry;
  // in this example the setup creates the icon if the first radio button is
  // selected
  Result := MyOptionsPage.Values[0];
end;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top