VerifyAudio




Declare Function sndPlaySound% Lib "MMSYSTEM.DLL" (ByVal lpszSoundName$,
ByVal wFlags%)
Global Const SND_SYNC = &H0000
Global Const SND_ASYNC = &H0001
Global Const SND_NODEFAULT = &H0002
Global Const SND_LOOP = &H0008
Global Const SND_NOSTOP = &H0010
' Paramaters:

' lpszSoundName$

' Specifies the name of the sound to play. The function first

' searches the [sounds] section of the WIN.INI file for an entry

' with the specified name, and plays the associated waveform sound

' file. If no entry by this name exists, then it assumes the

' specified name is the name of a waveform sound file. If this

' parameter is NULL, any currently playing sound is stopped.

' That is, use a 0& to provide a NULL value.

' wFlags%

' Specifies options for playing the sound using one or more

' of the following flags:

' SND_SYNC: The sound is played synchronously and the function

' does not return until the sound ends.

' SND_ASYNC: The sound is played asynchronously and the function

' returns immediately after beginning the sound.

' SND_NODEFAULT: If the sound cannot be found, the function returns

' silently without playing the default sound.

' SND_LOOP: The sound will continue to play 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_NOSTOP: If a sound is currently playing, the function will

' immediately return False without playing the requested sound.

' Add the following code to the appropriate routine:

Dim SoundName$
Dim wFlags%
Dim x%
SoundName$ = "c:\windows\tada.wav" ' The file to play
wFlags% = SND_ASYNC Or SND_NODEFAULT
x% = sndPlaySound(SoundName$,wFlags%)
Note: This has only been tested with VB 3 and VB 4-16,
if you convert this for use with other versions please
let me know.-Burt Abreu
Declare this API and these Constants in a .BAS file:










( verifyaudio.html )- by Paolo Puglisi - Modifica del 17/12/2023