问题描述
我正在尝试在VS.NET中创建一个MSI,它将检查已安装的Office
系统组件 - 所以我的MDE只会在满足要求的情况下安装。
我正在考虑使用VBScript检查注册表项/值。任何人
之前在这条路上旅行?其他建议?
提前致谢。
I''m trying to create an MSI in VS.NET that will check for installed Office
System components - so my MDE will only install if requirements are met.
I''m thinking about using VBScript to inspect Registry keys/values. Anyone
travel this road before? Other suggestions?
Thanks in advance.
推荐答案
我试过这个:
Public Function CheckComponents()As Boolean
On Error GoTo HandleErr
Dim varExe As Variant
CheckComponents = False
对于每个varExe In Array(WINWORD.EXE,OUTLOOK.EXE,EXCEL.EXE)
使用Application.FileSearch
.NewSearch
.LookIn =" C:\Program Files\Microsoft Office \OFFICE11 \"
.SearchSubFolders = False
.Filename = varExe
.MatchTextExactly = True
.FileType = msoFileTypeAllFi les
CheckComponents = IIf(.Execute(),True,False)
结束
如果CheckComponents = False那么
MsgBox varExe& "这个应用程序需要正常运行。
退出
结束如果
下一页
退出功能
但它' '非常*很慢。尽管如此,从应用程序内部检查已安装组件的想法,而不是安装例程,可能是一个
选项...
I tried this:
Public Function CheckComponents() As Boolean
On Error GoTo HandleErr
Dim varExe As Variant
CheckComponents = False
For Each varExe In Array("WINWORD.EXE", "OUTLOOK.EXE", "EXCEL.EXE")
With Application.FileSearch
.NewSearch
.LookIn = "C:\Program Files\Microsoft Office\OFFICE11\"
.SearchSubFolders = False
.Filename = varExe
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
CheckComponents = IIf(.Execute(), True, False)
End With
If CheckComponents = False Then
MsgBox varExe & " is required for for this application to
function properly."
Exit For
End If
Next
Exit Function
But it''s *very* slow. Still, the idea of checking for installed components
from within the app, rather than with an install routine, may be an
option...
我把你的计时器功能类似于我修改过的
版本中的一个:
函数CheckComps()
Dim varExe As Variant
Dim sngStart As Single
sngStart =计时器
CheckComps = False
For Each varExe In Array(WINWORD.EXE,OUTLOOK.EXE,EXCEL.EXE)
CheckComps = Len(Dir
I put a timer function in yours similar to the one in my modified
version below:
Function CheckComps()
Dim varExe As Variant
Dim sngStart As Single
sngStart = Timer
CheckComps = False
For Each varExe In Array("WINWORD.EXE", "OUTLOOK.EXE", "EXCEL.EXE")
CheckComps = Len(Dir
这篇关于如何检查已安装的组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!