mfenske17363
asked on
Cannot silence a looping sound from a VB6 app
We have a legacy VB 6 app that uses the PlaySound function in winmm.dll to play .WAV files. Some sounds are played in a loop (SND_ASYNC+SND_LOOP) while others are not. The user silences the looping sounds by pressing a key which calls PlaySound again using a .WAV file that is empty and the options SND_PURGE + SND_NODEFAULT.
This code has worked for a long time (and continues to work) with WIndows XP 32-bit.
When run on a Windows 7 64-bit OS the single sound works as before but attempting to use the existing code to silence the looping sound does not work (the sound continues to play until the process is killed).
Anyone experience this behavior?
What is the fix for this?
Thanks!
This code has worked for a long time (and continues to work) with WIndows XP 32-bit.
When run on a Windows 7 64-bit OS the single sound works as before but attempting to use the existing code to silence the looping sound does not work (the sound continues to play until the process is killed).
Anyone experience this behavior?
What is the fix for this?
Thanks!
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
No other answer was correct
Private Sub StopWav()
PlaySound vbNullString, ByVal 0&, SND_PURGE
End Sub