gpt4 book ai didi

inno-setup - 从多个条目将参数传递给 Inno Setup Check 函数

转载 作者:行者123 更新时间:2023-12-05 04:17:55 25 4
gpt4 key购买 nike

我有很多[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

最佳答案

我不太确定我是否答对了你的问题,但是好吧,为了写一个 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;

关于inno-setup - 从多个条目将参数传递给 Inno Setup Check 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20149410/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com