Jump to content
Sign in to follow this  
faire

Detecting soundcard

Recommended Posts

faire

Is it possible to detect whether a user has a soundcard installed? My app has some background music, but it shows some nasty errors if there's no soundcard available. Of course I've made a "-nomusic" switch, but it would still be better if I could detect whether a soundcard is available. Perhaps there's a registry key somewhere that I can read..?

Share this post


Link to post
Share on other sites
evilertoaster

$NumberOfSoundCards=DllCall("winmm.dll","uint","waveOutGetNumDevs")
MsgBox(0,"Number of sound cards is:",$NumberOfSoundCards[0])

Share this post


Link to post
Share on other sites
faire

$NumberOfSoundCards=DllCall("winmm.dll","uint","waveOutGetNumDevs")
MsgBox(0,"Number of sound cards is:",$NumberOfSoundCards[0])
Sweeeet. I can confirm it works, because I have 2 soundcards and it in fact returns 2.

If you don't mind me asking, how did you find out which DllCall to perform?

Edit: aha, MSDN: http://msdn.microsoft.com/en-us/library/ms713748(VS.85).aspx. I can see how that fits together with the command.

Edited by faire

Share this post


Link to post
Share on other sites
evilertoaster

If you don't mind me asking, how did you find out which DllCall to perform?

As with a LARGE number of questions on this forum, I simply ask google the same question, (often appending a 'VB' to get programing related results) and then convert the answer into autoit.

search phrase: detect a sound card VB

first result.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×