How can I check for sound card?

  • Thread starter Thread starter Mats-Lennart Hansson
  • Start date Start date
M

Mats-Lennart Hansson

Hi,
Is there a way to check for sound cards in c#? I don't want to force the
user to have DirectX9 or so, can I perhaps use winmm.dll?

Any help, and code snippets, is highly appreciated!

Thanks,
Mats-Lennart
 
That's right - you need to import a winmm.dll function.
If you just want to make sure that this PC does have a sound card you
may use this:
[DllImport("winmm.dll", SetLastError = true)]
public static extern uint waveOutGetNumDevs();
If result is non-zero then you can expect a device.
 
This works fine. Thanks!

Vitaly Zayko said:
That's right - you need to import a winmm.dll function.
If you just want to make sure that this PC does have a sound card you may
use this:
[DllImport("winmm.dll", SetLastError = true)]
public static extern uint waveOutGetNumDevs();
If result is non-zero then you can expect a device.

Mats-Lennart Hansson said:
Hi,
Is there a way to check for sound cards in c#? I don't want to force the
user to have DirectX9 or so, can I perhaps use winmm.dll?

Any help, and code snippets, is highly appreciated!

Thanks,
Mats-Lennart
 
Back
Top