知道MsiQueryFeatureState API函数的请进

wangRobin 2010-06-23 10:13:22
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#代码,返回的结果也是一样的)
大家如果在自己电脑上运行了,请回复一下返回的结果,看看跟我电脑运行的结果是不是一样.

感谢~
...全文
52 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangRobin 2010-06-25
  • 打赏
  • 举报
回复
感谢 xingyuebuyu,
呵呵,对VB.Net不太熟悉
yuanhuiqiao 2010-06-23
  • 打赏
  • 举报
回复
相同~~
xingyuebuyu 2010-06-23
  • 打赏
  • 举报
回复
Private Declare Function MsiQueryFeatureState Lib "Msi" Alias "MsiQueryFeatureStateA" (ByVal Product As String, ByVal Feature As String) As Integer


上面是VB6.0的API声明,其中Long对应VB.NET中的Integer
wangRobin 2010-06-23
  • 打赏
  • 举报
回复
代码的地址
http://support.microsoft.com/kb/285884/zh-cn

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧