-
WHen I use this to play a .wav it stops the actions in the form, how could I make the .wav play, and still have the stuff in the form move?
Option Explicit
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_FILENAME = &H20000 ' name is a file name
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_SYNC = &H0
Private Sub Play_Sound_Click()
PlaySound App.Path & "\ILOVEYOUVIRUS.wav.vbs.mp3.wav.vbs.jpg.wav", 0, SND_SYNC
End Sub
-
Play it ASYNC instead of SYNC
-
Thanks a lot! One more thing... what code can I use to make the sound stop when the command button function is pressed?
-
Im still interested in stopping it whenever they hit ok...
-
To stop playing a WAV:
Code:
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_PURGE = &H40
Private Sub cmdPlay_Click()
'Play the WAV file
PlaySound "C:\MyWav.wav", 0, SND_ASYNC
End Sub
Private Sub cmdStop_Click()
'Stop the WAV file
PlaySound "", 0, SND_PURGE
End Sub
-