Inno Script [代码] 部分中的类型不匹配错误
Type mismatch error in Inno Script [Code] section
我修改了我的功能:
function IsVCRedist32BitNeeded(): boolean;
var
Major, Minor, Bld, Rbld: Cardinal;
VCRuntimeInstalled: boolean;
begin
VCRuntimeInstalled := false; { Assume that VC Runtime is not installed }
Result := true;
{ Version number is: Major.Minor.Bld.Rbld }
{ Minimum valid version is: 14.14.26429.03 }
if (RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Major', Major) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Minor', Minor) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Bld', Bld) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Rbld', Rbld)) then
begin
VCRuntimeInstalled := true;
end
else if (RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Major', Major) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Minor', Minor) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Bld', Bld) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Rbld', Rbld)) then
begin
VCRuntimeInstalled := true;
end;
if(VCRuntimeInstalled) then
begin
{ Is the installed version at least 14.14 ? }
Result := Major < 14 or
(Major = 14 and (Minor < 14 or
(Minor = 14 and (Bld < 26429 or
(Bld = 26429 and Rbld < 3)))));
{ 'true' means we need to run the installer }
if (Result) then
begin
Log('Visual Studio Redist x86 is not already installed');
Result := True;
end
else
Log(FmtMessage('Visual Studio Redist x86 Version : found v%1.%2.%3.%4', [Major, Minor, Bld, Rbld]));
end;
end;
end;
它不会编译。它抱怨第 978 行类型不匹配:
Result := Major < 14 or
(Major = 14 and (Minor < 14 or
(Minor = 14 and (Bld < 26429 or
(Bld = 26429 and Rbld < 3)))));
怎么了?
无需对 VC++ 运行时进行任何检查。
只需安装它们 - 如果已经安装就不会出现问题。此外,安装只需要几分钟,因此您可以继续执行安装程序中的任何操作(您无需等待它完成)。
此外,目标机器上所需的 VC++ 运行时取决于您的应用程序以及您在 Visual Studio 开发期间的设置方式。
Pascal 脚本似乎具有非标准的运算符优先级。
额外的括号将解决这个问题(无论如何使用它们总是更好):
Result := (Major < 14) or
((Major = 14) and ((Minor < 14) or
((Minor = 14) and ((Bld < 26429) or
((Bld = 26429) and (Rbld < 3))))));
我修改了我的功能:
function IsVCRedist32BitNeeded(): boolean;
var
Major, Minor, Bld, Rbld: Cardinal;
VCRuntimeInstalled: boolean;
begin
VCRuntimeInstalled := false; { Assume that VC Runtime is not installed }
Result := true;
{ Version number is: Major.Minor.Bld.Rbld }
{ Minimum valid version is: 14.14.26429.03 }
if (RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Major', Major) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Minor', Minor) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Bld', Bld) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Rbld', Rbld)) then
begin
VCRuntimeInstalled := true;
end
else if (RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Major', Major) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Minor', Minor) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Bld', Bld) and
RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio.0\VC\Runtimes\x86', 'Rbld', Rbld)) then
begin
VCRuntimeInstalled := true;
end;
if(VCRuntimeInstalled) then
begin
{ Is the installed version at least 14.14 ? }
Result := Major < 14 or
(Major = 14 and (Minor < 14 or
(Minor = 14 and (Bld < 26429 or
(Bld = 26429 and Rbld < 3)))));
{ 'true' means we need to run the installer }
if (Result) then
begin
Log('Visual Studio Redist x86 is not already installed');
Result := True;
end
else
Log(FmtMessage('Visual Studio Redist x86 Version : found v%1.%2.%3.%4', [Major, Minor, Bld, Rbld]));
end;
end;
end;
它不会编译。它抱怨第 978 行类型不匹配:
Result := Major < 14 or
(Major = 14 and (Minor < 14 or
(Minor = 14 and (Bld < 26429 or
(Bld = 26429 and Rbld < 3)))));
怎么了?
无需对 VC++ 运行时进行任何检查。
只需安装它们 - 如果已经安装就不会出现问题。此外,安装只需要几分钟,因此您可以继续执行安装程序中的任何操作(您无需等待它完成)。
此外,目标机器上所需的 VC++ 运行时取决于您的应用程序以及您在 Visual Studio 开发期间的设置方式。
Pascal 脚本似乎具有非标准的运算符优先级。
额外的括号将解决这个问题(无论如何使用它们总是更好):
Result := (Major < 14) or
((Major = 14) and ((Minor < 14) or
((Minor = 14) and ((Bld < 26429) or
((Bld = 26429) and (Rbld < 3))))));