知道MsiQueryFeatureState API函数的请进
Private Declare Function MsiQueryFeatureState Lib "Msi" Alias "MsiQueryFeatureStateA" (ByVal Product As String, ByVal Feature As String) As Long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Start Word.
Dim wdApp As Object
wdApp = CreateObject("Excel.Application")
' Get the Product Code.
Dim szCode As String
szCode = wdApp.ProductCode
' Get FeatureState for the VBAFiles Feature.
Dim x As Long
x = MsiQueryFeatureState(szCode, "VBAFiles")
If (x = 1) Or (x = 3) Or (x = 4) Then
MsgBox("VBA is installed")
Else
MsgBox("VBA is NOT installed")
End If
End Sub
上面代码的作用是判断Excel是否安装了VBA组件,代码是从MSDN上找来的。
但是在我电脑上运行MsiQueryFeatureState函数返回的结果x 跟MSDN上的代码不一样,
代码是If (x = 1) Or (x = 3) Or (x = 4) Then 表示安装了VBA,
我的电脑安装了VBA,运行返回的结果是 8976488881364926467 一串数字。
请专家解答一下。
(VB代码可转换成C#代码,返回的结果也是一样的)
大家如果在自己电脑上运行了,请回复一下返回的结果,看看跟我电脑运行的结果是不是一样.
感谢~