Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to play Wave File.........
Message
De
08/09/2003 15:17:57
 
 
À
08/09/2003 09:14:37
Mazahir Naya
Kuwait United Co.
Kuwait, Kuwait
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00827031
Message ID:
00827241
Vues:
17
Hi Mazahir,

Here is a function that plays any .wav file passed to it in parameters. The syntax is
BELL( cWaveFileName [, lSynchronous ] )
This is the code:
********************************************************************************
FUNCTION BELL( tcWaveFile, tlSynchronous )
********************************************************************************
*	OVERVIEW	Sounds the .Wav or other sound file specified in tcWaveFile.
*
*			If the .Wav file cannot be found, sounds the system event
*			default sound.  If the sound file cannot be found and the
*			system event default sound is not defined, no sound is made and
*			.F. is returned.  If the sound file or system default sound
*			is played, returns .T.
*
*	PARAMETERS	
*
*	tcWaveFile	A fully qualified path to a .Wav or other sound file
*			compatable with the default sound player.
*
*	tlSynchronous   If true, plays the sound synchronously.  If false, or omitted
*			play the cound asynchronously.
*
LOCAL laDLLs[ 1 ], lnInt

SET TALK OFF

laDLLs[ 1 ] = ''

ADLLS( laDLLs )

*	If the sndPlaySound function has not yet been declared, declare it
*	now.
IF ASCAN( laDLLs, 'sndPlaySound', 1, ALEN( laDLLs, 1 ), 1, 11 ) = 0

	DECLARE ;
		INTEGER sndPlaySound IN WinMM.DLL ;
		STRING cSoundName, ;
		INTEGER uFlags

ENDIF

*	Send 0x00 as the second parameter to play the sound synchronously.
*	Send 0x01 to play asynchronously.  We want asynchronous sound
*	( plays in the background without halting processing processing. )
*	unless tlSynchronous is true.
IF !EMPTY( tlSynchronous )
	lnInt = 0x00
ELSE
	lnInt = 0x01
ENDIF	

RETURN SndPlaySound( tcWaveFile , lnInt )

ENDFUNC && BELL()
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform