79.2 Playing Waveform Sounds

One basic use of sound is associating a sound with a user action or with a warning or alert message. These sounds tend to be short in duration and are often played repeatedly. Windows provides two functions to play waveform sounds:

Function Description

MessageBeep Plays the sound that corresponds to a given system-alert level.
sndPlaySound Plays the sound that corresponds to the given filename or WIN.INI entry.

These functions provide the following methods of playing waveform sounds:

Playing WAVE files stored on a hard disk or CD-ROM

Playing in-memory WAVE resources

Playing WAVE files specified by entries in the WIN.INI file

Playing WAVE files associated with system-alert levels