'检查函数
'若安装了.NET Framework,返回:True
Public Function IsMSFrameworkInstalled() As Boolean
On Error Resume Next
Dim objWMIService
Dim colItems
Dim objItem
Set objWMIService = GetObject("winmgmts://./root/cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Product")
For Each objItem In colItems
If InStr(objItem.Name, "Microsoft .NET Framework") > 0 Then
IsMSFrameworkInstalled = True
End If
Next
End Function
'示例
Private Sub Command1_Click()
MsgBox IsMSFrameworkInstalled()
End Sub
标签:Dim,IsMSFrameworkInstalled,objItem,Windows,Framework,VB6,NET,colItems From: https://blog.51cto.com/u_8260968/6025950