nmretd
Dec 15th, 1999, 09:34 PM
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 ?
Serge
Dec 15th, 1999, 09:40 PM
Sure thing!
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
As you can see, I'm using 2 command buttons: cmdStart and cmdStop. Also, just substitue the file name with the appropriate one.
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
[This message has been edited by Serge (edited 12-16-1999).]