How can I detect if the system has a sound card?
A lot of programs are now playing sounds for certain events. However, there is no point in wasting time by playing a sound if the system does not support it. This tip demonstrates how to detect if a sound card exists.
Declarations
Add the following code to the declarations section of the project.
Declare Function waveOutGetNumDevs Lib "winmm.dll" _ Alias "waveOutGetNumDevs" () As Long
Code
Dim i As Integer
i = waveOutGetNumDevs()
If i > 0 Then
MsgBox "Your system can play sound files.", _
vbInformation, "Sound Card Test"
Else
MsgBox "Your system can not play sound Files.", _
vbInformation, "Sound Card Test"
End If