Vassili Philippov (vasja@spbteam.com), August 23, 2001.
There are several functions on Pocket PC that can be used for playing sound in your program. These are: PlaySound, MessageBeep, waveOutWrite and other waveOut... functions.
It's easy to play sound using PlaySound function. Let's start with an example. The following code plays empty.wav files in \Windows folder. If your \Windows folder doesn't contain this file then copy any .wav file and rename it to empty.wav.
PlaySound function can play .wav file from different sources. In the example above it plays it from a file. It can also play a file using data in memory and in application resources. This function can also be used for playing system sounds.
There are two modes of playing sound synchronous and asynchronous. Use SND_SYNC and SND_ASYNC values in flag parameter to choose a necessary mode.
Example:
Playing .wav file you should remember that Pocket PC doesn't support relative file names. So you should always provide the full path to the file.
Playing sound from a resource can be convenient if your application has a fixed number of sounds to play. Using resources instead of files allows you to avoid many .wav files that can be extremely helpful if you are going to create an application that consists of one executable file.
First of all you should create .wav resources. Create a custom resource:

enter WAVE resource type:

choose the resource name and file where the sound will be stored:

Then copy necessary .wav file into testsound.wav and you could use this resource like:
Sometimes it's necessary to play sounds when the content of .wav file is stored in memory. I used to meet two situations: one when I received a file using network and another when I read a .wav file from compound document. The content of the .wav file should be located as one piece of memory. An example below reads the file into memory (assuming that the file size is less then 100Kb) and then plays sound from memory:
PlaySound function is suitable when your sound is in .wav format. You could add some .wav sounds to resources that will allow you to avoid additional .wav files in an application.