Declare Function sndPlaySound% Lib "MMSYSTEM.DLL" (ByVal lpszSoundName$, ByVal wFlags%)Global Const SND_SYNC = &H0000Global Const SND_ASYNC = &H0001Global Const SND_NODEFAULT = &H0002Global Const SND_LOOP = &H0008Global 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 playwFlags% = SND_ASYNC Or SND_NODEFAULTx% = sndPlaySound(SoundName$,wFlags%)---------------------------------------------------

评论