Skip to content Skip to sidebar Skip to footer

Adding A Help Button To An Innosetup Wizard Page

I have a setup script with a custom wizard page to get a choice from the user. It would be nice to have a help button and to supply a small CHM file with the installable so that I

Solution 1:

See this post for details on how to include a file with the installation package and reference that file before installation has started.

To add a button to the install wizard, I included the following code in the InitializeWizard event handler.

procedure CreateHelpButton (ParentForm   : TSetupForm ; 
                            X            : integer ;
                            Y            : integer ;
                            W            : integer ;
                            H            : integer) ;

var
  HelpButton : TNewButton ;
begin
  HelpButton         := TNewButton.Create (ParentForm) ;
  HelpButton.Left    := X ;
  HelpButton.Top     := Y ;
  HelpButton.Width   := W ;
  HelpButton.Height  := H ;
  HelpButton.Caption := '&Help' ;
  HelpButton.OnClick := @HelpButtonOnClick ;
  HelpButton.Parent  := ParentForm ;
end;

procedure InitializeWizard () ;

begin
  CreateHelpButton (
    WizardForm, ScaleX (20), WizardForm.CancelButton.Top,
    WizardForm.CancelButton.Width, WizardForm.CancelButton.Height) ;
end;  

Solution 2:

Just to complete the listing:

procedure HelpButtonOnClick(Sender: TObject);
var
  ResultCode: Integer;
begin
  ExtractTemporaryFile('installer.chm');

  if (FileExists(ExpandConstant('{tmp}\installer.chm'))) thenbegin
    ShellExec('', ExpandConstant('{tmp}\installer.chm'), '', ExpandConstant('{tmp}'), SW_SHOW, ewNoWait, ResultCode);
  end;
end;

Post a Comment for "Adding A Help Button To An Innosetup Wizard Page"