问题
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 can provide a detailed explanation of what the choices are.
Anyone know whether there is an easy way to do this?
回答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;
回答2:
Just to complete the listing:
procedure HelpButtonOnClick(Sender: TObject);
var
ResultCode: Integer;
begin
ExtractTemporaryFile('installer.chm');
if (FileExists(ExpandConstant('{tmp}\installer.chm'))) then
begin
ShellExec('', ExpandConstant('{tmp}\installer.chm'), '', ExpandConstant('{tmp}'), SW_SHOW, ewNoWait, ResultCode);
end;
end;
来源:https://stackoverflow.com/questions/5658488/adding-a-help-button-to-an-innosetup-wizard-page