Using the PlaySound Function with Waveform Audio Files

In Windows CE, most waveform audio files use the .wav file name extension. The following code example shows how to play the \Sounds\Bells.wav file.

PlaySound (TEXT("\\SOUNDS\\BELLS.WAV"), NULL, SND_SYNC);

If the specified file does not exist or the file cannot be stored in available device memory, PlaySound plays the default system sound. If you have not defined a default system sound, PlaySound fails without playing a sound. The following code example shows how to specify that the default sound should not be played.

PlaySound (TEXT("\\SOUNDS\\BELLS.WAV"), NULL, SND_SYNC | SND_NODEFAULT);

The example uses the SND_NODEFAULT flag in the fdwSound parameter to prohibit the application from playing the default sound.