devxlogo

Check whether a sound card exists

Check whether a sound card exists

If you are developing a game in VB or an application that plays sounds, you probably want to check that a sound card actually exists. There is an API function that does this, and returns the number of sound cards installed in the system. Therefore, a return value of zero means that no devices are present or that an error occurred. This is an example:

Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As LongIf waveOutGetNumDevs() >= 1 Then    MsgBox "Your system supports a sound card."Else    MsgBox "Your system can't play sounds."End If

devx-admin

Share the Post: