sndPlaySound Function
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
NOTE: The function sndPlaySound is obsolete. It is superseded by the PlaySound function.
sndPlaySound plays either a .WAV file or a system-defined sound. If the SND_NODEFAULT flag is used, the function returns 0 if the .WAV file (or system sound) cannot be found and 1 if it is. If the flag is not set, the function always returns 1 and plays the Windows Default sound if the specified sound cannot be found.
- lpszSoundName
- Either the path and filename of the .WAV file to play, or the name of the system sound to play.
- uFlags
- Zero or more of the following flags specifying how to play the sound:
- SND_ALIAS = &H10000
- Play a Windows sound (such as SystemStart, Asterisk, etc.).
- SND_ASYNC = &H1
- Continue program execution immediately after starting to play the sound.
- SND_FILENAME = &H20000
- Play the specified filename.
- SND_LOOP = &H8
- Play the sound repeatedly until sndPlaySound is called again with lpszSoundName = "". SND_ASYNC must also be set.
- SND_NODEFAULT = &H2
- Do not play the Windows default sound if the specified sound cannot be found.
- SND_NOSTOP = &H10
- Do not stop playing any currently playing sounds.
- SND_NOWAIT = &H2000
- Do not wait if the sound driver is busy.
- SND_SYNC = &H0
- Wait until the sound has finished playing before continuing program execution.
Example:
' Play the Empty Recycle Bin system sound and pause
' program execution until the sound is finished playing.
Dim retval As Long
retval = sndPlaySound("EmptyRecycleBin", SND_ALIAS Or SND_SYNC) ' play the associated sound
Related Call: PlaySound
Category: Audio
Back to the index.
Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/s/sndplaysound.html