更简单的,去掉 [Tasks] 段,因为上面的脚本不会显示任务。
[Setup]
AppName=My Program
AppVerName=My Program version 1.5
DefaultDirName={pf}\My Program
DisableProgramGroupPage=yes
UninstallDisplayIcon={app}\MyProg.exe
OutputDir=userdocs:Inno Setup Examples Output
[Files]
Source: MyDll.dll; DestDir: {reg:HKLM32\SOFTWARE\Ulead Systems\5.0\Installer,Path}\plug; Flags: ignoreversion; check: CheckVersion('5.0')
Source: MyDll.dll; DestDir: {reg:HKLM32\SOFTWARE\Ulead Systems\6.0\Installer,Path}\plug; Flags: ignoreversion; check: CheckVersion('6.0')
Source: MyDll.dll; DestDir: {reg:HKLM32\SOFTWARE\Ulead Systems\7.0\Installer,Path}\plug; Flags: ignoreversion; check: CheckVersion('7.0')
Source: MyDll.dll; DestDir: {reg:HKLM32\SOFTWARE\Ulead Systems\8.0\Installer,Path}\plug; Flags: ignoreversion; check: CheckVersion('8.0')
Source: MyDll.dll; DestDir: {reg:HKLM32\SOFTWARE\Ulead Systems\9.0\Installer,Path}\plug; Flags: ignoreversion; check: CheckVersion('9.0')
[code]
function InitializeSetup (): Boolean;
var
i: integer;
begin
Result := False;
for i := 5 to 9 do
begin
if RegValueExists(HKLM32, 'SOFTWARE\Ulead Systems\' + IntToStr(i) + '.0\Installer','Path') then begin
Result := True;
break;
end;
end;
begin
if Result = False then begin
MsgBox('检测到没有安装原版,请先安装原版。', mbInformation, MB_OK);
end;
end;
end;
function CheckVersion(Version: string): Boolean;
begin
MsgBox(Version, mbInformation, MB_OK);
result:= RegValueExists(HKLM32, 'SOFTWARE\Ulead Systems\' + Version + '\Installer', 'Path');
end;