关闭

枚举声卡

666人阅读 评论(0) 收藏 举报

using System.Management;
StringBuilder sb = new StringBuilder();
ManagementObjectSearcher SoundDeviceQuery = new ManagementObjectSearcher("SELECT * FROM Win32_SoundDevice");
foreach (ManagementObject SoundDevice in SoundDeviceQuery.Get())
{
sb.AppendLine("==========================================================");
sb.AppendLine("Name : " + SoundDevice["Name"].ToString());
sb.AppendLine("DeviceID : " + SoundDevice["DeviceID"].ToString());
}
Output:
==========================================================
USB Audio Device
USB/VID_046D&PID_0A02&MI_00/6&39E4CC60&0&0000
==========================================================
USB Audio Device
USB/VID_046D&PID_0A02&MI_00/6&9124E6&0&0000
==========================================================


Realtek AC'97 Audio
PCI/VEN_8086&DEV_24D5&SUBSYS_1021147B&REV_02/3&13C0B0C5&0&FD
Code For Sound Device Enumeration:
using Microsoft.DirectX.DirectSound;
DevicesCollection dc = new DevicesCollection();
foreach (DeviceInformation di in dc)
{
MessageBox.Show(di.Description);
}
Output:
Realtek AC'97 Audio
Logitech USB Headset
Logitech USB Headset (2)

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:362512次
    • 积分:4532
    • 等级:
    • 排名:第6495名
    • 原创:68篇
    • 转载:175篇
    • 译文:0篇
    • 评论:28条
    最新评论