VB.Net声卡信息查询的实例
Imports System Imports System.Management Imports System.Windows.Forms
Namespace WMISample
Public Class MyWMIQuery
Public Overloads Shared Function Main() As Integer
Try Dim searcher As New ManagementObjectSearcher( _ "root\CIMV2", _ "SELECT * FROM Win32_SoundDevice WHERE Caption = 'SigmaTel High Definition Audio CODEC'")
For Each queryObj As ManagementObject in searcher.Get()
'更多vb.net实例与vb.net技术文章 来自乐博网LOB.cn
Console.WriteLine("-----------------------------------") Console.WriteLine("Win32_SoundDevice instance") Console.WriteLine("-----------------------------------") Console.WriteLine("Caption: {0}", queryObj("Caption")) ' 声卡描述 Console.WriteLine("DeviceID: {0}", queryObj("DeviceID")) '设备识别号 Console.WriteLine("Manufacturer: {0}", queryObj("Manufacturer")) '生产商 Console.WriteLine("PNPDeviceID: {0}", queryObj("PNPDeviceID")) 'PNP识别号 Console.WriteLine("PowerManagementSupported: {0}", queryObj("PowerManagementSupported"))
'是否支持电源管理 Console.WriteLine("Status: {0}", queryObj("Status")) ' 设备工作状态 Next Catch err As ManagementException MessageBox.Show(err.Message) End Try End Function End Class End Namespace |