【发布时间】:2016-02-29 22:26:37
【问题描述】:
我正在创建一个有点非传统的 Inno Setup 安装程序。我正在设置Uninstallable=no,但如果他们将来重新安装,我仍然需要能够记住用户为安装类型选择的内容。我考虑将类型写到我能够做到的文件中。但是,我不确定下次运行安装程序时如何设置类型。这是我存储类型的代码。
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep = ssDone) then
SaveStringToFile('{app}\type.dat', WizardSetupType(false), false);
end;
我知道如何读回这个,但我不确定如何设置类型。
编辑:
这是新代码
procedure CurPageChanged(CurPageID: Integer);
begin
{ We need to manually store and restore the install type since Uninstallable=no }
if (CurPageID = wpSelectComponents) then
WizardForm.TypesCombo.ItemIndex := GetIniInt('Settings', 'InstallType', 0, 0, 3, ExpandConstant('{app}\settings.ini'));
if (CurPageID = wpInstalling) then
SetIniInt('Settings', 'InstallType', WizardForm.TypesCombo.ItemIndex, ExpandConstant('{app}\settings.ini'));
end;
【问题讨论】: