sndPlaySound

This function plays a waveform sound.

BOOL sndPlaySound(
LPCTSTR lpszSoundName, 
UINT fuSound ); 

Parameters

  • lpszSoundName
    Long pointer to a null-terminated string that specifies the sound to play. This parameter can be either an entry in the registry or in WIN.INI that identifies a system sound, or it can be the name of a waveform-audio file. (If the function does not find the entry, the parameter is treated as a filename.) If this parameter is NULL, any currently playing sound is stopped.
  • fuSound
    Flags for playing the sound. The following values are defined:
    Value Description
    SND_ASYNC The sound is played asynchronously and the function returns immediately after beginning the sound. To terminate an asynchronously played sound, call sndPlaySound with lpszSoundName set to NULL.
    SND_LOOP The sound plays repeatedly until sndPlaySound is called again with the lpszSoundName parameter set to NULL. You must also specify the SND_ASYNC flag to loop sounds.
    SND_MEMORY The parameter specified by lpszSoundName points to an image of a waveform sound in memory.
    SND_NODEFAULT If the sound cannot be found, the function returns silently without playing the default sound.
    SND_NOSTOP If a sound is currently playing, the function immediately returns FALSE, without playing the requested sound.
    SND_SYNC The sound is played synchronously and the function does not return until the sound ends.

Return Values

TRUE indicates success. FALSE indicates failure.

Remarks

If the specified sound cannot be found, sndPlaySound plays the system default sound. If there is no system default entry in the registry or WIN.INI file, or if the default sound cannot be found, the function makes no sound and returns FALSE.

The specified sound must fit in available physical memory and be playable by an installed waveform-audio device driver.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 2.0 and later Mmsystem.h   Wavelib.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.