Inno Setup: How to create a password wizard page only if component "X" is selected

Can someone help me protect the group or component of choice.

For examples

If ('Readme.txt').selected or ('compact').selected = True then
begin "Password wizard page";
else
result := true;
end;

Something like this for this working script: P

function CheckPassword(Password: String): Boolean;
begin
 result := false;
 if (Password='component') or (Password='type') then
   result := true;
end;
+3
source share
1 answer

I'm not sure I fully understood your question, but maybe this helps. Here are a few functions that you only need to add to the section [code]in the Components.iss example, and one of the components ("Help") can be installed only when the user enters the correct password.

, , . :

[Code]
var
  PasswordPage: TInputQueryWizardPage;

procedure InitializeWizard();
begin
  PasswordPage := CreateInputQueryPage(wpSelectComponents, 
    'Your caption goes here',
    'Your description goes here',
    'Your subcaption goes here');
  PasswordPage.Add(SetupMessage(msgPasswordEditLabel), True);
end;

, , .

, :

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  Result := False;
  if PageID = PasswordPage.ID then begin
    // show password page only if help file is selected for installation
    Result := not IsComponentSelected('help');
  end;
end;

, , :

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  Result := True;
  if CurPageID = PasswordPage.ID then begin
    // stay on this page if password is wrong
    if PasswordPage.Edits[0].Text <> 'my-secret-password' then begin
      MsgBox(SetupMessage(msgIncorrectPassword), mbError, MB_OK);
      Result := False;
    end;
  end;
end;
+4

Source: https://habr.com/ru/post/1759623/


All Articles