[RESOLVED] Looping a .wav File
I can make it loop, but how do I make it Stop. :confused:
Here is my code, this is in a Module
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_SYNC = &H0
Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2
Private Const SND_LOOP = &H8
Private Const SND_NOSTOP = &H10
Private Const wFlags = SND_ASYNC Or SND_LOOP
Dim X%
Public Sub Play_LOOP(wavFile as String)
X = sndPlaySound (wavFile , wFlags)
End Sub
Public Sub StopPlay_LOOP(wavFile as String)
X = sndPlaySound( wavFile, SND_ASYNC ) 'wFlags SND_ASYNC
End Sub
The Form
Code:
Option Explicit
Dim myFileName$
Private Sub Form_Load()
myFileName = App.Path & "\tmpClick.wav"
Play_LOOP myFileName
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
StopPlay_LOOP ""
End Sub