使用inno安装程序安装程序调用RegQueryDWordValue以获取Office Excel版本

如何从registry中使用inno脚本安装MS Office Excel版本? 我试图波纹pipe的代码,它提供了“钥匙找不到”,但它存在

function InitializeSetup(): Boolean; var CurVer: Cardinal; key: string; if RegQueryDWordValue(HKCR, 'Excel.Application\CurVer\','Default', CurVer) then begin // Successfully read the value MsgBox('Excel Version: ' + IntTOStr(CurVer),mbInformation, MB_OK); end else begin MsgBox('Key not found',mbInformation, MB_OK); end; end; 

将RegQueryDWordValue更改为RegQueryStringValue

 function InitializeSetup(): Boolean; var CurVer: Cardinal; key: string; begin //if RegQueryDWordValue(HKCR, 'Excel.Application\\CurVer\\','', CurVer) then if RegQueryStringValue(HKCR, 'Excel.Application\CurVer\','', key) then begin // Successfully read the value MsgBox('Excel Version: ' + key,mbInformation, MB_OK); end else begin MsgBox('Excel Not installed',mbInformation, MB_OK); end; end; 

删除尾随的反斜杠。

另外,RegEdit中的(Default)值是没有名字的:

 if RegQueryDWordValue(HKCR, 'Excel.Application\CurVer','', CurVer) then