Inno 设置函数 - 无效原型
Inno Setup Function - Invalid Prototype
我正在使用 Inno Setup 进行安装,并将以下功能添加到现有的 [Code]
部分:
function Get64Or32: String;
begin
if IsWin64 then
begin
Result := 'Program Files (x86)';
end
else
begin
Result := 'Program Files';
end;
end;
我不断收到以下错误:
10:41:08 Invalid prototype for 'Get64Or32'
我尝试了几种排列组合,包括在函数名称后加上括号,但每次都出现相同的错误。
我正在尝试使用 [Registry]
部分中的这个来查明 Java 位置:
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType:string; ValueName:"JRE_HOME"; ValueData:"C:\{code:Get64or32}\Java\jre_1.8.0_151"; Flags: preservestringtype uninsdeletevalue uninsdeletekeyifempty; Permissions: users-modify;
如果你看这里 Pascal Scripting: Scripted Constants 它解释了一切。引用:
The syntax of a {code:...}
constant is: {code:FunctionName|Param}
The Pascal script can contain several functions which are called when
Setup wants to know the value of a scripted {code:...}
constant. The
called function must have 1 String
parameter named Param
, and must
return a String
or a Boolean
value depending on where the constant is
used.
The syntax of a {code:...}
constant is: {code:FunctionName|Param}
它还提供:
- 示例函数:
[Code]
function MyConst(Param: String): String;
begin
Result := ExpandConstant('{autopf}');
end;
- 用法示例:
[INI]
FileName: "{app}\MyIni.ini"; Section: "MySettings"; Key: "ShortApp"; String: "{code:GetShortName|{app}}"
您不必使用参数,但它必须是原型的一部分。
我正在使用 Inno Setup 进行安装,并将以下功能添加到现有的 [Code]
部分:
function Get64Or32: String;
begin
if IsWin64 then
begin
Result := 'Program Files (x86)';
end
else
begin
Result := 'Program Files';
end;
end;
我不断收到以下错误:
10:41:08 Invalid prototype for 'Get64Or32'
我尝试了几种排列组合,包括在函数名称后加上括号,但每次都出现相同的错误。
我正在尝试使用 [Registry]
部分中的这个来查明 Java 位置:
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType:string; ValueName:"JRE_HOME"; ValueData:"C:\{code:Get64or32}\Java\jre_1.8.0_151"; Flags: preservestringtype uninsdeletevalue uninsdeletekeyifempty; Permissions: users-modify;
如果你看这里 Pascal Scripting: Scripted Constants 它解释了一切。引用:
The syntax of a
{code:...}
constant is:{code:FunctionName|Param}
The Pascal script can contain several functions which are called when Setup wants to know the value of a scripted
{code:...}
constant. The called function must have 1String
parameter namedParam
, and must return aString
or aBoolean
value depending on where the constant is used.The syntax of a
{code:...}
constant is:{code:FunctionName|Param}
它还提供:
- 示例函数:
[Code]
function MyConst(Param: String): String;
begin
Result := ExpandConstant('{autopf}');
end;
- 用法示例:
[INI]
FileName: "{app}\MyIni.ini"; Section: "MySettings"; Key: "ShortApp"; String: "{code:GetShortName|{app}}"
您不必使用参数,但它必须是原型的一部分。