Link to home
Start Free TrialLog in
Avatar of mfenske17363
mfenske17363Flag for United States of America

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!
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

I've used this before, but haven't tested it on Win 7 x64:

    Private Sub StopWav()
        PlaySound vbNullString, ByVal 0&, SND_PURGE
    End Sub
ASKER CERTIFIED SOLUTION
Avatar of mfenske17363
mfenske17363
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mfenske17363

ASKER

No other answer was correct