首页 > 解决方案 > 在 Inno Setup Pascal 脚本中声明变量

问题描述

我已将以下代码添加到我的脚本中:

[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)

这里可能有什么错误?

标签: inno-setuppascalscript

解决方案


在 Pascal (Script) 中,您在实际代码之前使用关键字声明变量:var

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

推荐阅读