问题描述
我正在尝试使用Inno Setup来创建安装程序.我的第一次尝试是向用户报告当前安装了哪个.NET Framework.我想出了以下脚本,该脚本安装了令牌exe,但没有显示我想显示已安装Framework版本的消息框.
I am experimenting with Inno Setup in preparation for creating an installer. My first attempt is to report back to the user which .NET Framework is currently installed. I came up with the following script, which installs a token exe but it does not show the message box that I wanted to display the installed Framework version.
[Setup]
AppName=NETFramework_Test
AppVersion=1.0.0
DefaultDirName=c:\al\NetFWTest\test
WizardStyle=modern
OutputDir=c:\al\NetFWTest
[Files]
Source: "c:\al\computer\miscsmallapps\tmpdir\tmpdir.exe"; DestDir: "{app}";
[Code]
var
VersionNum: cardinal;
begin
if RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full',
'Version', VersionNum) then
begin
MsgBox('The installed .NET Framework version:' + IntToStr(VersionNum),
mbInformation, MB_OK);
end
else
begin
MsgBox('Error reading the Registry...', mbInformation, MB_OK);
end;
end.
推荐答案
您需要从某些 Inno Setup事件功能,例如 InitializeSetup
.
You need to call your code from some Inno Setup event function, like InitializeSetup
.
有关示例,请参见 Inno设置-如何在安装之前/安装过程中检查系统规格?
此外, Version
的值是字符串,因此您需要使用 RegQueryStringValue
.
Also, the Version
value is string, so you need to use RegQueryStringValue
.
这篇关于使用Inno Setup在安装过程中报告已安装的.NET Framework版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!