K·A

step by step!

枚举声卡

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)

阅读更多
文章标签: output audio c
个人分类: C#
想对作者说点什么? 我来说一句

枚举系统中所有硬件设备

2012年07月05日 8KB 下载

没有更多推荐了,返回首页

不良信息举报

枚举声卡

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭