【发布时间】:2023-01-25 05:16:46
【问题描述】:
在使用 Inno Setup 安装程序安装我们的 PowerPoint 加载项期间,我需要通过查询 Application.PowerPoint 对象本身来获取当前使用的 PowerPoint 版本 - 而不是依赖注册表项 which can't be guaranteed to give the correct value。
我已经使用以下代码为使用 WIX based on this answer 编写的 MSI 安装程序成功实现了这一点:
Imports Microsoft.Office.Interop.PowerPoint
Public Class Environment
Public Shared Function GetPowerPointVersion() As String
Dim CurVer As String
Dim thisPowerPoint As Object
thisPowerPoint = New Application()
CurVer = thisPowerPoint.Version
thisPowerPoint.Quit()
Return CurVer
End Function
End Class
我不完全相信这在所有情况下都有效(可能是偏执狂),所以如果失败,将放入 try/catch 块并使用注册表方法。
我一直无法弄清楚如何使用 Inno Setup 安装程序做类似的事情。有一些使用 DLL 的示例 - https://jrsoftware.org/ishelp/index.php?topic=scriptdll - 但我看不出如何从中创建一个可从 Inno Setup 调用的函数,该函数将返回版本号。
【问题讨论】:
标签: vb.net powerpoint inno-setup office-interop