我有很多[components]
,我只想编写一个函数来检查他们的特定注册表项。我可以为每个条目编写一个函数,但我想在一个函数中总结它们。有任何想法吗? :)
试图说明:
[components]
Name: "MyProgram for A"; (...); Check: CheckRegKey
Name: "MyProgram for B"; (...); Check: CheckRegKey
Name: "MyProgram for C"; (...); Check: CheckRegKey
...
[code]
function CheckRegKey: Boolean;
begin
Result:=RegValueExists(HKLM64, '...', '...')
//check if A is installed
//check if B, C,... or a mix of them is installed
答案 0 :(得分:2)
我不确定我的问题是否正确,但是,对于为不同的组件条目编写单个Check
参数函数,您需要有一个输入参数,通过该参数可以区分这些组件。代码如下:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Components]
Name: "A"; Description: "MyProgram for A"; Check: CheckRegKey(1)
Name: "B"; Description: "MyProgram for B"; Check: CheckRegKey(2)
Name: "C"; Description: "MyProgram for C"; Check: CheckRegKey(3)
[Code]
function CheckRegKey(CompType: Integer): Boolean;
begin
Result := False;
case CompType of
1: Result := RegValueExists(...);
2: Result := RegValueExists(...);
3: Result := RegValueExists(...);
end;
end;