Use sndPlaySound to play short WAV files. Pass the WAV file as the first argument and flags as the second argument. If the file is not found, Windows will play a default sound unless you use SND_NODEFAULT in the flags. Here are all the possible flags:
| SND_SYNC | Don't return until the sound completes (default) |
| SND_ASYNC | Return right away - sound keeps playing |
| SND_NODEFAULT | If file not found, do nothing (otherwise, Windows plays the default |
| SND_MEMORY | File "name" is really a pointer to WAV data in memory |
| SND_LOOP | Keep playing sound until next call to sndPlaySound |
| SND_NOSTOP | Don't stop playing current wave file |
| SND_NOWAIT | If driver is busy, return |
| SND_ALIAS | Name is a registry alias for a sound file |
| SND_ALIAS_ID | Name is a predefined alias name |
| SND_RESOURCE | Name is a WAV resource |
| SND_FILENAME | Name is a filename (default) |
| SND_PURGE | Purge sound events (Windows 95 only) |
| SND_APPLICATION | Look for app-specific registry entry (Windows 95 only) |
Example:
sndPlaySound("XYZ.WAV",SND_SYNC|SND_NODEFAULT|SND_FILENAME);
Under Windows 3.1, the sound file you want to play must fit into memory.