是否可以禁用组件页面进行升级?我想启用软件的升级,但是我不想让用户在升级时更改组件的选择。相反,安装程序会从首次安装中升级所有现有组件。
我担心用户在升级过程中选择的组件较少,那些丢失的组件将保留为旧版本,而您会陷入混乱。
我在脚本中添加了以下内容:
[Setup]
DisableDirPage=auto
DisableProgramGroupPage=auto
DirExistsWarning=auto
我只需要一种禁用组件页面并使用先前安装(完全安装)的选择进行升级的方法。有可能吗?
我找到了相关的指令:
[Setup]
UsePreviousTasks=true
UsePreviousTasks
正在从注册表中读取现有部分,这很好。现在,我需要找到一种隐藏选择窗口的方法。
谢谢,沃尔夫冈
[Code]
const
UninstallKey = 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppId")}_is1';
function IsUpgrade: Boolean;
var
Value: string;
begin
Result := (RegQueryStringValue(HKLM, UninstallKey, 'UninstallString', Value) or
RegQueryStringValue(HKCU, UninstallKey, 'UninstallString', Value)) and (Value <> '');
end;
procedure DisablePageControls(Page: TNewNotebookPage);
var
I: Integer;
begin
Page.Enabled := False;
for I := 0 to Page.ControlCount - 1 do
Page.Controls[I].Enabled := False;
end;
procedure InitializeWizard;
begin
if IsUpgrade then
DisablePageControls(WizardForm.SelectComponentsPage);
end;
AppId
将单独的function IsUpgrade: Boolean;
var
Value: string;
UninstallKey: string;
begin
UninstallKey := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' +
ExpandConstant('{#SetupSetting("AppId")}') + '_is1';
Result := (RegQueryStringValue(HKLM, UninstallKey, 'UninstallString', Value) or
RegQueryStringValue(HKCU, UninstallKey, 'UninstallString', Value)) and (Value <> '');
end;
留给该函数,它将无法使用该额外的函数。
除此之外,64位系统似乎不会引起任何问题。如果InnoSetup以32位模式运行,则注册表虚拟化已生效,并且已将您重定向到正确的密钥。