如何在 InnoSetup 安装程序中显示更大的许可证框?

发布于 2024-10-08 07:45:58 字数 187 浏览 0 评论 0原文

默认情况下,InnoSetup 在一个非常小的文本区域中显示许可协议,用户无法以任何方式放大该文本区域。

虽然我知道大多数人不会阅读这些内容,但我认为以一种特别难以阅读的格式提供它是一个坏主意,并且可能构成法庭辩护的一部分。

InnoSetup 有没有办法在一个大的单独窗口中显示许可证?也许是预先卷好的 Pascal 脚本?

InnoSetup by default displays the license agreement in a really tiny text area that the user can't make bigger in any way.

While I know most people don't read these, I feel that providing it in a format that makes it particularly hard to read is a bad idea, and might form part of a defense in court.

Is there any way in InnoSetup to display the license in a large separate window? A pre-rolled Pascal script perhaps?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

逆光下的微笑 2024-10-15 07:45:59

如果您想让 WizardForm 变大,您可以更改 WizardForm 的大小并重新排列其中的控件。我制作此示例是为了向您展示如何更改许可证页面的表单高度。

[Setup]
AppName=StackOverflow large license box
AppVersion=1.0
CreateAppDir=no
DisableProgramGroupPage=yes
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
LicenseFile=license.txt
;OutputDir=userdocs:Inno Setup Examples Output

[Code]

var
  DefaultTop, 
  DefaultLeft, 
  DefaultHeight,
  DefaultBackTop, 
  DefaultNextTop, 
  DefaultCancelTop,
  DefaultBevelTop, 
  DefaultOuterHeight: Integer;

const 
  LicenseHeight = 600;

procedure InitializeWizard();
begin
  DefaultTop := WizardForm.Top;
  DefaultLeft := WizardForm.Left;
  DefaultHeight := WizardForm.Height;
  DefaultBackTop := WizardForm.BackButton.Top;
  DefaultNextTop := WizardForm.NextButton.Top;
  DefaultCancelTop := WizardForm.CancelButton.Top;
  DefaultBevelTop := WizardForm.Bevel.Top;
  DefaultOuterHeight := WizardForm.OuterNotebook.Height;

  WizardForm.InnerPage.Height := WizardForm.InnerPage.Height + (LicenseHeight - DefaultHeight);
  WizardForm.InnerNotebook.Height :=  WizardForm.InnerNotebook.Height + (LicenseHeight - DefaultHeight);
  WizardForm.LicensePage.Height := WizardForm.LicensePage.Height + (LicenseHeight - DefaultHeight);
  WizardForm.LicenseMemo.Height := WizardForm.LicenseMemo.Height + (LicenseHeight - DefaultHeight);
  WizardForm.LicenseNotAcceptedRadio.Top := WizardForm.LicenseNotAcceptedRadio.Top + (LicenseHeight - DefaultHeight);
  WizardForm.LicenseAcceptedRadio.Top := WizardForm.LicenseAcceptedRadio.Top + (LicenseHeight - DefaultHeight);

end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpLicense then
  begin
    WizardForm.Top := DefaultTop - (LicenseHeight - DefaultHeight) div 2;
    WizardForm.Height := LicenseHeight;
    WizardForm.OuterNotebook.Height := WizardForm.OuterNotebook.Height + (LicenseHeight - DefaultHeight);
    WizardForm.CancelButton.Top := DefaultCancelTop + (LicenseHeight - DefaultHeight);
    WizardForm.NextButton.Top := DefaultNextTop + (LicenseHeight - DefaultHeight);
    WizardForm.BackButton.Top := DefaultBackTop + (LicenseHeight - DefaultHeight);
    WizardForm.Bevel.Top := DefaultBevelTop + (LicenseHeight - DefaultHeight);
  end
  else 
  begin
    WizardForm.Top := DefaultTop;
    WizardForm.Left := DefaultLeft;
    WizardForm.Height := DefaultHeight;
    WizardForm.OuterNotebook.Height := DefaultOuterHeight;
    WizardForm.CancelButton.Top := DefaultCancelTop;
    WizardForm.NextButton.Top := DefaultNextTop;
    WizardForm.BackButton.Top := DefaultBackTop;
    WizardForm.Bevel.Top := DefaultBevelTop;
  end;
end;

将其复制到新的 iss 文件并提供有效的 license.txt 文件才能成功编译。该脚本在 inno 5.4.0 上进行了测试,但它应该适用于任何 5.x。

You can change the WizardForm size and rearrange the controls in it if you want to make it bigger. I made this example to show you how to change the form height for the License page.

[Setup]
AppName=StackOverflow large license box
AppVersion=1.0
CreateAppDir=no
DisableProgramGroupPage=yes
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
LicenseFile=license.txt
;OutputDir=userdocs:Inno Setup Examples Output

[Code]

var
  DefaultTop, 
  DefaultLeft, 
  DefaultHeight,
  DefaultBackTop, 
  DefaultNextTop, 
  DefaultCancelTop,
  DefaultBevelTop, 
  DefaultOuterHeight: Integer;

const 
  LicenseHeight = 600;

procedure InitializeWizard();
begin
  DefaultTop := WizardForm.Top;
  DefaultLeft := WizardForm.Left;
  DefaultHeight := WizardForm.Height;
  DefaultBackTop := WizardForm.BackButton.Top;
  DefaultNextTop := WizardForm.NextButton.Top;
  DefaultCancelTop := WizardForm.CancelButton.Top;
  DefaultBevelTop := WizardForm.Bevel.Top;
  DefaultOuterHeight := WizardForm.OuterNotebook.Height;

  WizardForm.InnerPage.Height := WizardForm.InnerPage.Height + (LicenseHeight - DefaultHeight);
  WizardForm.InnerNotebook.Height :=  WizardForm.InnerNotebook.Height + (LicenseHeight - DefaultHeight);
  WizardForm.LicensePage.Height := WizardForm.LicensePage.Height + (LicenseHeight - DefaultHeight);
  WizardForm.LicenseMemo.Height := WizardForm.LicenseMemo.Height + (LicenseHeight - DefaultHeight);
  WizardForm.LicenseNotAcceptedRadio.Top := WizardForm.LicenseNotAcceptedRadio.Top + (LicenseHeight - DefaultHeight);
  WizardForm.LicenseAcceptedRadio.Top := WizardForm.LicenseAcceptedRadio.Top + (LicenseHeight - DefaultHeight);

end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpLicense then
  begin
    WizardForm.Top := DefaultTop - (LicenseHeight - DefaultHeight) div 2;
    WizardForm.Height := LicenseHeight;
    WizardForm.OuterNotebook.Height := WizardForm.OuterNotebook.Height + (LicenseHeight - DefaultHeight);
    WizardForm.CancelButton.Top := DefaultCancelTop + (LicenseHeight - DefaultHeight);
    WizardForm.NextButton.Top := DefaultNextTop + (LicenseHeight - DefaultHeight);
    WizardForm.BackButton.Top := DefaultBackTop + (LicenseHeight - DefaultHeight);
    WizardForm.Bevel.Top := DefaultBevelTop + (LicenseHeight - DefaultHeight);
  end
  else 
  begin
    WizardForm.Top := DefaultTop;
    WizardForm.Left := DefaultLeft;
    WizardForm.Height := DefaultHeight;
    WizardForm.OuterNotebook.Height := DefaultOuterHeight;
    WizardForm.CancelButton.Top := DefaultCancelTop;
    WizardForm.NextButton.Top := DefaultNextTop;
    WizardForm.BackButton.Top := DefaultBackTop;
    WizardForm.Bevel.Top := DefaultBevelTop;
  end;
end;

Copy it to a new iss file and provide a valid license.txt file in order to compile successfully. The script is tested with inno 5.4.0 but it should work with any 5.x.

窗影残 2024-10-15 07:45:59

调整许可证框的大小效果不太好,因此我们最终提供了一个按钮来在写字板中查看许可证。这效果出奇的好;我最终还是比较喜欢它。代码:

procedure ViewLicenseButtonClick(Sender: TObject);
var WordpadLoc: String;
    RetCode: Integer;
begin
  RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WORDPAD.EXE', '', WordpadLoc);

  // on NT/2000 it's a REG_EXPAND_SZ, so expand constant ProgramFiles
  StringChange(WordpadLoc, '%ProgramFiles%', ExpandConstant('{pf}'));
  // remove " at begin and end pf string
  StringChange(WordpadLoc, '"', '');

  try
    ExtractTemporaryFile('LicenseAgreement.rtf')
  except
    MsgBox('Cannot extract license file.', mbError, mb_Ok);
  end;

  if not Exec(WordpadLoc, '"' + ExpandConstant('{tmp}\LicenseAgreement.rtf') + '"', '', SW_SHOW, ewNoWait, RetCode) then
    MsgBox('Cannot display license file.', mbError, mb_Ok);
end;

procedure CurPageChanged(CurPageID: Integer);
var ViewLicenseButton: TButton;
begin
  if CurPageID = wpLicense then begin
    ViewLicenseButton := TButton.Create(WizardForm.LicenseMemo.Parent);
    ViewLicenseButton.Caption := '&View in WordPad';
    ViewLicenseButton.Width := 120;
    ViewLicenseButton.Left := WizardForm.LicenseMemo.Left +
                        WizardForm.LicenseMemo.Width - ViewLicenseButton.Width;
    ViewLicenseButton.Top := WizardForm.LicenseMemo.Top +
                        WizardForm.LicenseMemo.Height + 16;
    ViewLicenseButton.OnClick := @ViewLicenseButtonClick;
    ViewLicenseButton.Parent := WizardForm.LicenseAcceptedRadio.Parent;
  end;
end;

Resizing the license box didn't work too well, so instead we ended up providing a button to view the license in WordPad. This works surprisingly well; I rather liked it in the end. Code:

procedure ViewLicenseButtonClick(Sender: TObject);
var WordpadLoc: String;
    RetCode: Integer;
begin
  RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WORDPAD.EXE', '', WordpadLoc);

  // on NT/2000 it's a REG_EXPAND_SZ, so expand constant ProgramFiles
  StringChange(WordpadLoc, '%ProgramFiles%', ExpandConstant('{pf}'));
  // remove " at begin and end pf string
  StringChange(WordpadLoc, '"', '');

  try
    ExtractTemporaryFile('LicenseAgreement.rtf')
  except
    MsgBox('Cannot extract license file.', mbError, mb_Ok);
  end;

  if not Exec(WordpadLoc, '"' + ExpandConstant('{tmp}\LicenseAgreement.rtf') + '"', '', SW_SHOW, ewNoWait, RetCode) then
    MsgBox('Cannot display license file.', mbError, mb_Ok);
end;

procedure CurPageChanged(CurPageID: Integer);
var ViewLicenseButton: TButton;
begin
  if CurPageID = wpLicense then begin
    ViewLicenseButton := TButton.Create(WizardForm.LicenseMemo.Parent);
    ViewLicenseButton.Caption := '&View in WordPad';
    ViewLicenseButton.Width := 120;
    ViewLicenseButton.Left := WizardForm.LicenseMemo.Left +
                        WizardForm.LicenseMemo.Width - ViewLicenseButton.Width;
    ViewLicenseButton.Top := WizardForm.LicenseMemo.Top +
                        WizardForm.LicenseMemo.Height + 16;
    ViewLicenseButton.OnClick := @ViewLicenseButtonClick;
    ViewLicenseButton.Parent := WizardForm.LicenseAcceptedRadio.Parent;
  end;
end;
你是暖光i 2024-10-15 07:45:59

如果您使用 LicenseFile 指令,则 Inno 需要纯文本或 RTF 文件。如果您提供 RTF 文件,您可以根据需要设置字体和其他简单格式(粗体、斜体等)。

If you use the LicenseFile directive than Inno expects a plain text or RTF file. If you provide an RTF file you can set the font and other simple formatting (bold, italic etc) as you wish.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文