Hi, my app plays sound as part of its functionality, but a lot of my users don't have sound cards. Is there some way to detect whether or not they have one, to avoid an automation error when i try to play sound?
Thanx all for helping,
Printable View
Hi, my app plays sound as part of its functionality, but a lot of my users don't have sound cards. Is there some way to detect whether or not they have one, to avoid an automation error when i try to play sound?
Thanx all for helping,
*bump*
How are you playing the sounds? API? Can't you trap for the error, and if you get it, discontinue the sounds?
:)
You can detect a sound-card using APIs. Here's the code ....
Declare Function waveOutGetNumDevs Lib "winmm.dll" Alias "waveOutGetNumDevs" () As Long
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
i'm using the media player component, and i don't want to trap the error everytime i try to play a sound, i want to check the system at the start of the prog and set a no sound flag if it fails. I could do it crudely using a mediaplayer component on the startup form and if i get an error, set the flag, but i don't really want to do it that way. I thought maybe there was an api or some method to check for installed devices
Typical, someone always posts exactly what you are looking for when you are explaining what it is you want. Thanks hamin, i'll try your code now.