Inno 设置和 DefaultDirName

发布于 2024-10-02 04:41:16 字数 617 浏览 0 评论 0原文

是否有某种方法可以根据用户在安装时所做的某些决定通过代码设置 DefaultDirName?

我来评论一下: 我有一些为两个不同系统构建的代码(使用不同的互操作/ocx 等)。我的输入文件存储在两个目录 input\A 和 input\B 中。 我只想为两个系统提供一个安装文件。

在安装文件中,我使用 CreateInputOptionPage 和 2 个选项来确定要安装哪些文件(对每个文件使用“检查”)。这工作正常。

但我在安装完成时也有一些 ShellExec,目前它使用 {app} 来注册一些 .Net 类,并使用 ShellExec 在 InitializeUninstall 上取消注册 .Net 类(也使用 {app})。

安装程序必须安装该软件位于两个不同的位置(取决于用户的选择(例如 c:\software_a 或 c:\software_b)。无法更改这一点。

那么在将文件复制到系统之前是否有某种方法可以指定 DefaultDirName,所以我可以在安装和卸载时使用相同的 ShellExec 吗?我当然可以在安装时为两个系统添加相同的 ShellExec 并使用 if 来检查要注册的文件(取决于用户选择),但在卸载时我不会有这个信息(用户选择),所以我无法取消注册 .Net 类,

谢谢。

Is there some way to set the DefaultDirName by code depending on some decission a user did on installtion?

Let me comment:
I have some code which is build for two different systems (using different interops/ocx's and such stuff). My input files are stored in two directories input\A and input\B.
I want to have only one setup-file for both systems.

In the setup file i use CreateInputOptionPage with 2 options to determin which files to install (using Check on each file). This works okay.

But i do also have some ShellExec on finish of setup, which at the moment uses {app} to e.g. register some .Net classes and ShellExec to unregister the .Net classes on InitializeUninstall (also uses {app})

The setup must install the software on two different locations (depending on the selection of the user (eg. c:\software_a or c:\software_b). Can't change this.

So is there some way to specify the DefaultDirName before the files get copied to the system, so i can use the same ShellExec on install and uninstall? I could of course add the same ShellExec for both systems on installtation and use an if to check which files to register (depending on the user selection) but on uninstall i would not have this information (user selection), so i can not unregister the .Net classes.

thanks

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

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

发布评论

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

评论(2

浅黛梨妆こ 2024-10-09 04:41:16

在 CreateInputOptionPage 代码部分中,您可以设置一个值,然后在下面的代码片段中使用该值。我还没有测试过,但它可能有效。

[Setup]
DefaultDirName={code:getpath}

[Code]
function GetPath( Default: string ): string;
begin

if (CreateInputOptionPageValue1) then
 Result := ExpandConstant({sd}) + '\path1';
else
 Result := ExpandConstant({sd}) + '\path2';
end;

In your CreateInputOptionPage code section, you might be able to set a value then use that value in the code snippet below. I haven't tested it but it might work.

[Setup]
DefaultDirName={code:getpath}

[Code]
function GetPath( Default: string ): string;
begin

if (CreateInputOptionPageValue1) then
 Result := ExpandConstant({sd}) + '\path1';
else
 Result := ExpandConstant({sd}) + '\path2';
end;
零時差 2024-10-09 04:41:16

如果您需要在初始化 DefaultDirName 后更改安装文件夹,这对我来说非常有效:

procedure CurPageChanged(CurPageID: Integer);
begin
  { updates the install path depending on the install type or the entered suffix }
  if CurPageID = wpSelectDir then begin
     WizardForm.DirEdit.Text := ExpandConstant('{pf}') + '\MyAppName' + GetAppSuffix('');
  end;
end;

干杯
克里斯

If you need to change the install folder after the DefaultDirName has been initialized, this was working for me quite well:

procedure CurPageChanged(CurPageID: Integer);
begin
  { updates the install path depending on the install type or the entered suffix }
  if CurPageID = wpSelectDir then begin
     WizardForm.DirEdit.Text := ExpandConstant('{pf}') + '\MyAppName' + GetAppSuffix('');
  end;
end;

Cheers
Chris

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