求几个vb申明
wmiSoundDeviceInfowmiVideoControllerInfo
wmiPhysicalMemoryInfo
Command1_Click
追问:大哥 这个是利用这几个api函数的做法把 不是申明啊
wmiSoundDeviceInfowmiVideoControllerInfo
wmiPhysicalMemoryInfo
Command1_Click
追问:大哥 这个是利用这几个api函数的做法把 不是申明啊
答案:
用wmi获得系统信息
'获取显卡/声卡/内存/操作系统的信息 工程--引用 Microsoft WMI Scripting V1.1 Library
'声卡信息
Private Sub wmiSoundDeviceInfo()
Dim wmiObjSet As SWbemObjectSet
Dim obj As SWbemObject
Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
InstancesOf("Win32_SoundDevice")
On Local Error Resume Next
For Each obj In wmiObjSet
MsgBox obj.ProductName
Next
End Sub
'显卡信息
Private Sub wmiVideoControllerInfo()
Dim wmiObjSet As SWbemObjectSet
Dim obj As SWbemObject
Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
InstancesOf("Win32_VideoController")
On Local Error Resume Next
For Each obj In wmiObjSet
MsgBox obj.VideoProcessor
Next
End Sub
'内存信息
Private Sub wmiPhysicalMemoryInfo()
Dim wmiObjSet As SWbemObjectSet
Dim obj As SWbemObject
Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}"). _
InstancesOf("Win32_PhysicalMemory")
On Local Error Resume Next
For Each objItem In wmiObjSet
Debug.Print "BankLabel: " & objItem.BankLabel
Debug.Print "Capacity: " & objItem.Capacity
Debug.Print "Caption: " & objItem.Caption
Debug.Print "CreationClassName: " & objItem.CreationClassName
Debug.Print "DataWidth: " & objItem.DataWidth
Debug.Print "Description: " & objItem.Description
Debug.Print "DeviceLocator: " & objItem.DeviceLocator
Debug.Print "FormFactor: " & objItem.FormFactor
Debug.Print "HotSwappable: " & objItem.HotSwappable
Debug.Print "InstallDate: " & objItem.InstallDate
Debug.Print "InterleaveDataDepth: " & objItem.InterleaveDataDepth
Debug.Print "InterleavePosition: " & objItem.InterleavePosition
Debug.Print "Manufacturer: " & objItem.Manufacturer
Debug.Print "MemoryType: " & objItem.MemoryType
Debug.Print "Model: " & objItem.Model
Debug.Print "Name: " & objItem.Name
Debug.Print "OtherIdentifyingInfo: " & objItem.OtherIdentifyingInfo
Debug.Print "PartNumber: " & objItem.PartNumber
Debug.Print "PositionInRow: " & objItem.PositionInRow
Debug.Print "PoweredOn: " & objItem.PoweredOn
Debug.Print "Removable: " & objItem.Removable
Debug.Print "Replaceable: " & objItem.Replaceable
Debug.Print "SerialNumber: " & objItem.SerialNumber
Debug.Print "SKU: " & objItem.SKU
Debug.Print "Speed: " & objItem.Speed
Debug.Print "Status: " & objItem.Status
Debug.Print "Tag: " & objItem.Tag
Debug.Print "TotalWidth: " & objItem.TotalWidth
Debug.Print "TypeDetail: " & objItem.TypeDetail
Debug.Print "Version: " & objItem.Version
Next
End Sub
'作系统信息
Private Sub Command1_Click()
Dim wmiObjSet As SWbemObjectSet
Dim obj As SWbemObject
Dim msg As String
Dim dtb As String
Dim d As String
Dim t As String
Dim bias As Long
On Local Error Resume Next
Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_OperatingSystem")
For Each obj In wmiObjSet
MsgBox "你当前使用的系统是 " & obj.Caption
Next
End Sub
Private Sub Command2_Click()
'内存
Call wmiPhysicalMemoryInfo
End Sub
Private Sub Command3_Click()
'显卡
Call wmiVideoControllerInfo
End Sub