Using PlaySound with Registry-Specified Sounds

The PlaySound function also plays sounds referred to by a key name in the registry. Using this feature, you can let users assign selected or custom sounds to system alerts and warnings. Sounds associated with system alerts and warnings are called sound events.

    To play a sound event

Note PlaySound plays the default system sound if the registry entry specified in pszSound does not exist or if the sound file cannot be stored in available device memory.

The sndPlaySound function searches the registry for a key name matching lpszSound before attempting to load a file with the pszSound name. The PlaySound function accepts flags that specify the location of the sound.