Inno setup 加上一句「;“打印协议”;Inno设置中许可证页面的按钮

Inno setup 加上一句「;“打印协议”;Inno设置中许可证页面的按钮,inno-setup,Inno Setup,我需要帮助将按钮(打印协议)放在Inno设置表单上,以便通过打印机打印EULA 在安装过程中,当用户协议页面显示时,有3个按钮(后退、下一步和取消)。我想再添加一个按钮“打印”,以便用户可以打印EULA文档。有什么办法吗?这是我编写的一个简单脚本,它在许可证屏幕上显示一个打印按钮,然后打开记事本,其中包含可以打印的许可证文件。 ShellExec可以更改为“打印”动词(在代码中显示,但注释掉),以便它可以自动打印到默认打印机。但这并没有考虑到没有安装打印机的系统。代码是: ; Script ge

我需要帮助将按钮(打印协议)放在Inno设置表单上,以便通过打印机打印EULA


在安装过程中,当用户协议页面显示时,有3个按钮(后退、下一步和取消)。我想再添加一个按钮“打印”,以便用户可以打印EULA文档。有什么办法吗?

这是我编写的一个简单脚本,它在许可证屏幕上显示一个打印按钮,然后打开记事本,其中包含可以打印的许可证文件。
ShellExec可以更改为“打印”动词(在代码中显示,但注释掉),以便它可以自动打印到默认打印机。但这并没有考虑到没有安装打印机的系统。代码是:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{19ECF086-08A1-4A60-891F-E4D57E1266CF}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes   
LicenseFile=c:\license.txt

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\util\innosetup\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "c:\license.txt"; DestDir: "{tmp}"; Flags: dontcopy
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon


[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: nowait postinstall skipifsilent

[code]
var PrintButton: TButton;

procedure PrintButtonClick(Sender: TObject);
var ResultCode :integer;
begin
log('test');
ExtractTemporaryFile('license.txt');
//if not ShellExec('Print', ExpandConstant('{tmp}\license.txt'),
//     '', '', SW_SHOW, ewNoWait, ResultCode) then
if not ShellExec('', ExpandConstant('{tmp}\license.txt'),
     '', '', SW_SHOW, ewNoWait, ResultCode) then
log('test');
end;

procedure InitializeWizard();
begin
    PrintButton := TButton.Create(WizardForm);
    PrintButton.Caption := '&Print...';
    PrintButton.Left := WizardForm.InfoAfterPage.Left + 96;
    PrintButton.Top := WizardForm.InfoAfterPage.Height + 88;
    PrintButton.OnClick := @PrintButtonClick;
    PrintButton.Parent := WizardForm.NextButton.Parent;
end;

procedure CurPageChanged(CurPage: Integer);

begin
  PrintButton.Visible := CurPage = wpLicense;
end;

CurPageChanged
的实现伤害了我的眼睛!请执行
PrintButton.Visible:=CurPage=wpplicense取而代之!是的,我把它从一个更大的脚本中剥离出来,在不同的页面上做了一些事情。我现在已经修好了。谢谢米尔泰尔……非常感谢。看完脚本后,它看起来很简单。:)