检查c#中安装的音频语音驱动程序

时间:2012-06-24 07:41:10

标签: visual-studio-2010 c#-4.0

我在winform应用程序中使用声音播放器。 有没有办法在OS上检查声卡驱动程序(已安装/未安装)? 我想在c#

中programatel

1 个答案:

答案 0 :(得分:1)

我明白了

using System.Runtime.InteropServices;

[DllImport("winmm.dll", SetLastError = true)]
public static extern uint waveOutGetNumDevs();

private void frmSound_Load(object sender, System.EventArgs e){
if(waveOutGetNumDevs() != 0)
{
  lblSound.Text = "The Sound device is detected for this system";
}
else
{
    lblSound.ForeColor = Color.Red; 
    lblSound.Text = "The Sound device is Not Found for this system";
}
}