Play .WAV (example 1)
No attachments for this post
Check if soundcard exist and then play a wave-file. http://18.104.22.168:2080/VisualBasicSource/vb4playwav.txt
Original Author: Found on the World Wide Web
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Declare Function waveOutGetNumDevs Lib "winmm" () As Long
Global Const SND_SYNC = &H0 'just after the sound is ended exit function
Global Const SND_ASYNC = &H1 'just after the beginning of the sound exit function
Global Const SND_NODEFAULT = &H2 'if the sound cannot be found no error message
Global Const SND_LOOP = &H8 'repeat the sound until the function is called again
GLOBAL Const SND_NOSTOP = &H10 'if currently a sound is played the function will return without playing the selected sound
Global Const Flags& = SND_ASYNC Or SND_NODEFAULT
'Add the following code to the Command1_Click event on a form:
Private Sub Command1_Click()
'Add the following code to the Command1_Click event:
Dim i As Long
Const SoundFileName$ = "c:sb16sampless_16_44.wav"
i = waveOutGetNumDevs()
If i > 0 Then 'There is at least one sound device.
i& = sndPlaySound(SoundFileName$, Flags&)
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.