I want to play a wav file in VB, it is a short file, I want it to be repeated several times in a loop so that it sounds continuous.
Can anyone help me ?
Printable View
I want to play a wav file in VB, it is a short file, I want it to be repeated several times in a loop so that it sounds continuous.
Can anyone help me ?
Sure thing!
As you can see, I'm using 2 command buttons: cmdStart and cmdStop. Also, just substitue the file name with the appropriate one.Code:Option Explicit
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_LOOP = &H8
Private Const SND_NODEFAULT = &H2
Private Sub cmdStart_Click()
sndPlaySound "C:\WINNT\Media\ding.wav", SND_ASYNC Or SND_LOOP
End Sub
Private Sub cmdStop_Click()
sndPlaySound "C:\WINNT\Media\ding.wav", 0
End Sub
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 12-16-1999).]