Inno设置和DefaultDirName [英] Inno setup and DefaultDirName
问题描述
是否有某种方法可以根据用户在安装过程中所做的决定通过代码设置DefaultDirName?
Is there some way to set the DefaultDirName by code depending on some decission a user did on installtion?
让我评论: 我有一些代码是为两个不同的系统构建的(使用不同的互操作/ocx和类似的东西).我的输入文件存储在两个目录input \ A和input \ B中. 我只希望两个系统都有一个安装文件.
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.
在安装文件中,我使用带有2个选项的CreateInputOptionPage来确定要安装的文件(对每个文件使用检查").可以.
In the setup file i use CreateInputOptionPage with 2 options to determin which files to install (using Check on each file). This works okay.
但是我在安装完成时确实也有一些ShellExec,目前使用{app}来例如注册一些.Net类和ShellExec以在InitializeUninstall上注销.Net类(也使用{app})
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})
安装程序必须在两个不同的位置安装软件(取决于用户的选择(例如c:\ software_a或c:\ software_b).无法更改.
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.
那么在将文件复制到系统之前,是否有某种方法可以指定DefaultDirName,因此我可以在安装和卸载时使用相同的ShellExec?我当然可以在安装时为两个系统添加相同的ShellExec,并使用if检查要注册的文件(取决于用户选择),但是在卸载时我将没有此信息(用户选择),因此我无法取消注册.Net类.
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.
谢谢
推荐答案
如果在DefaultDirName初始化后需要更改安装文件夹,则对我来说效果很好:
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;
欢呼 克里斯
这篇关于Inno设置和DefaultDirName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!