steve marchant
2004-07-21 17:38:49 UTC
I used the following code to start and stop a wav sound. Note the use of
separate buttons to start and stop the sound. I'd appreciate seeing code
which will enable the sound to be toggled on/off by a single button (eg.
Command1). Any suggestions,please?
steve
Const SND_LOOP = &H8
Const SND_ASYNC = &H1
Const SND_PURGE = &H40
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Sub Command1_Click()
PlaySound "C:\windows\media\microsoft office 2000\ricochet.wav", 0,
SND__LOOP Or SND_ASYNC
End Sub
'this procedure stops repeated playsound.
Private Sub Command2_Click()
PlaySound "", 0, SND_PURGE
End Sub
separate buttons to start and stop the sound. I'd appreciate seeing code
which will enable the sound to be toggled on/off by a single button (eg.
Command1). Any suggestions,please?
steve
Const SND_LOOP = &H8
Const SND_ASYNC = &H1
Const SND_PURGE = &H40
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Sub Command1_Click()
PlaySound "C:\windows\media\microsoft office 2000\ricochet.wav", 0,
SND__LOOP Or SND_ASYNC
End Sub
'this procedure stops repeated playsound.
Private Sub Command2_Click()
PlaySound "", 0, SND_PURGE
End Sub