Check if the computer supports sound

Applies To

OS:
VB:
NT, 9x, 2000
5, 6

The function below indicates whether the computer supports sound. What it doesn't do is tell you whether the computer has a sound card installed. Because you could have a sound card installed but it could be disabled or simply drivers are not installed.

Add the following to a .BAS, .FRM or .CLS

'Place in General declarations
Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long

'Returns True or False indicating whether Sound functions will work
Public Function SoundSupported() As Boolean
    SoundSupported = IIf(waveOutGetNumDevs() <> 0, True, False)
End Function