How can I check for sound card?

  • Thread starter Mats-Lennart Hansson
  • 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
 
V

Vitaly Zayko

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.
 
M

Mats-Lennart Hansson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top