在Inno Setup Pascal脚本中声明变量

时间:2019-03-27 21:47:03

标签: inno-setup pascalscript

我在脚本中添加了以下代码:

[Code]
function IsSomeAppInstalled: Boolean;
begin
  Result := FileExists(ExpandConstant('{pf32}\SomeApp\Some.dll'));
end;

function InitializeSetup(): Boolean;
begin
   Boolean bIsInstalled := IsSomeAppInstalled();
   MsgBox('IsSomeAppInstalled: ' + IntToStr(Integer(bIsInstalled)), mbInformation, MB_OK);
   Result := true;
end;

Boolean bIsInstalled := IsSomeAppInstalled();

引发错误

  

内部错误(20)

这里可能是什么错误?

1 个答案:

答案 0 :(得分:4)

在Pascal(脚本)中,您declare variables using var keyword在实际代码之前:

function InitializeSetup(): Boolean;
var
  bIsInstalled: Boolean;
begin
  bIsInstalled := IsSomeAppInstalled();
  MsgBox('IsSomeAppInstalled: ' + IntToStr(Integer(bIsInstalled)), mbInformation, MB_OK);
  Result := true;
end;