安装前在向导中打开文档

Opening a document in wizard before install

我的问题是我想制作一个 "hyperlink"(我知道 inno 现在有这样的东西)当你点击标签时,一个带有说明的文档 (rtf) 将打开。

The problem: i DON'T want to copy this program along with the setup, it should be inside the setup and after the installation it is no more needed, thus it should be deleted or thrown out.

无法使用 {tmp} 文件夹,因为它只能在 [run] 阶段访问(如果我没记错的话就是安装阶段),我更早需要它。

有什么建议吗?

临时文件夹未明确保留给 [Run] 部分。它可以在需要时使用(它被广泛用于例如 DLL 库)。据我所知,Inno Setup 中没有 hyperlink label 这样的东西。我制作了 an examplelink 标签 并将其扩展为打开从安装存档中提取到临时文件夹(已删除的文件夹)的文件当安装程序终止时):

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Files]
; the dontcopy flag tells the installer that this file is not going to be copied to
; the target system
Source: "File.txt"; Flags: dontcopy

[Code]
var
  LinkLabel: TLabel;

procedure LinkLabelClick(Sender: TObject);
var
  FileName: string;
  ErrorCode: Integer;
begin
  FileName := ExpandConstant('{tmp}\File.txt');
  // if the file was not yet extracted into the temporary folder, do it now
  if not FileExists(FileName) then
    ExtractTemporaryFile('File.txt');
  // open the file from the temporary folder; if that fails, show the error message
  if not ShellExec('', FileName, '', '', SW_SHOW, ewNoWait, ErrorCode) then
    MsgBox(Format('File could not be opened. Code: %d', [ErrorCode]), mbError, MB_OK);
end;

procedure InitializeWizard;
begin
  LinkLabel := TLabel.Create(WizardForm);
  LinkLabel.Parent := WizardForm;
  LinkLabel.Left := 8;
  LinkLabel.Top := WizardForm.ClientHeight - LinkLabel.ClientHeight - 8;
  LinkLabel.Cursor := crHand;
  LinkLabel.Font.Color := clBlue;
  LinkLabel.Font.Style := [fsUnderline];
  LinkLabel.Caption := 'Click me to read something important!';
  LinkLabel.OnClick := @LinkLabelClick;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  LinkLabel.Visible := CurPageID <> wpLicense;
end;