Using PlaySound to Loop Sounds

If you specify the SND_LOOP and SND_ASYNC flags for the fdwSound parameter of the PlaySound function, the sound will continue to play repeatedly as shown in the following example:


If you want to loop a sound, you must play it asynchronously; you cannot use the SND_SYNC flag with the SND_LOOP flag. A looped sound will continue to play until you call PlaySound to play another sound. To stop playing a sound (looped or asynchronous) without playing another sound, use the following statement:

PlaySound(NULL, NULL, 0);