0

我在我的 winform 应用程序中使用声音播放器。有没有办法在操作系统上检查声卡驱动程序(已安装/未安装)?我想在 c# 中以编程方式检查它

4

1 回答 1

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";
}
}
于 2012-06-24T07:50:52.827 回答