
#PLAY SOUND COMMAND WINDOWS#
PlaySound searches the following directories for sound files: the current directory the Windows directory the Windows system directory directories listed in the PATH environment variable and the list of directories mapped in a network.

The sound specified by pszSound must fit into available physical memory and be playable by an installed waveform-audio device driver. Returns TRUE if successful or FALSE otherwise. If this flag is not set, the sound is assigned to the default audio session for the application's process.įor more information, see the documentation for the Core Audio APIs. Setting this flag puts the sound under the control of that volume slider The system volume-control program (SndVol) displays a volume slider that controls system notification sounds. If this flag is set, the sound is assigned to the audio session for system notification sounds. Note Previous versions of the documentation implied incorrectly that this flag is supported. Sounds played in other processes are not affected. If this flag is not specified, PlaySound attempts to stop any sound that is currently playing in the same process. If a sound cannot be played because the resource needed to generate that sound is busy playing another sound, the function immediately returns FALSE without playing the requested sound.

The specified sound event will yield to another sound event that is already playing in the same process. If the sound cannot be found, PlaySound returns silently without playing the default sound. The pszSound parameter points to a sound loaded in memory.įor more information, see Playing WAVE Resources. If this flag is set, you must also set the SND_ASYNC flag. The sound plays repeatedly until PlaySound is called again with the pszSound parameter set to NULL. If the file cannot be found, the function plays the default sound unless the SND_NODEFAULT flag is set. To terminate an asynchronously played waveform sound, call PlaySound with pszSound set to NULL. The sound is played asynchronously and PlaySound returns immediately after beginning the sound. The pszSound parameter is a predefined identifier for a system-event alias. Do not use with either SND_FILENAME or SND_RESOURCE. The pszSound parameter is a system-event alias in the registry or the WIN.INI file. You can combine this flag with the SND_ALIAS or SND_ALIAS_ID flag to specify an application-defined sound alias. The pszSound parameter is an application-specific alias in the registry. This parameter must be NULL unless SND_RESOURCE is specified in fdwSound.įlags for playing the sound. Handle to the executable file that contains the resource to be loaded. If no association is found in the registry, the name is interpreted as a file name. If an association is found, the sound event is played. If none of these flags are specified, PlaySound searches the registry or the WIN.INI file for an association with the specified sound name.

Three flags in fdwSound ( SND_ALIAS, SND_FILENAME, and SND_RESOURCE) determine whether the name is interpreted as an alias for a system event, a file name, or a resource identifier.

To stop a non-waveform sound, specify SND_PURGE in the fdwSound parameter. If this parameter is NULL, any currently playing waveform sound is stopped. The maximum length, including the null terminator, is 256 characters. (A system event may be associated with a sound in the registry or in the WIN.INI file.) Syntax BOOL PlaySound(Ī string that specifies the sound to play. The PlaySound function plays a sound specified by the given file name, resource, or system event.
