#region 声卡信息
/// <summary>
/// 获取声卡信息
/// </summary>
private void GetSoundDeviceProperties()
{
try
{
ObjectGetOptions options = new ObjectGetOptions(null, TimeSpan.MaxValue, true);
ManagementClass class2 = new ManagementClass("root\CIMV2", "Win32_SoundDevice", options);
class2.Options.UseAmendedQualifiers = true;
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_SoundDevice");
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_SoundDevice instance");
Console.WriteLine("-----------------------------------");
foreach (PropertyData data in class2.Properties)
{
string str = data.Name;
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine(string.Format("{0}:{1}", str, queryObj[str]));
}
}
}
catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.StackTrace + ":" + ex.Message); }
}
#endregion