How would I stop a sound playing with PlaySound()?

If I already had a looping sound playing:

PlaySound(TEXT("sounds/Theme.wav"), NULL, SND_LOOP | SND_ASYNC);

How would I stop it later in the program?
Well, to anyone out there wondering, playing any new sound stops the previous one. So if you want to stop sounds all together I would just create a new wave file without any content inside of it and play it.
It also helps to read the documentation for the function you are using:
http://www.google.com/search?btnI=1&q=msdn+PlaySound

SND_ASYNC

The sound is played asynchronously and PlaySound returns immediately after beginning the sound. To terminate an asynchronously played waveform sound, call PlaySound with pszSound set to NULL.

Hence, PlaySound( NULL, NULL, 0 ) will stop it, without the extra file or resource drain.

Hope this helps.
Topic archived. No new replies allowed.