General information
Category:
Forms & Form designer
Don / Jason / Christian:
Here is a little trick i figured out from david frankenburg (sp?) on using the windows api to play a sound from vfp.
using this you can:
play a sound synchronously (like using the chr(7))
asynch (it runs in the background)
loop the wav file to play continuously
stop the loop
hth
scott
how to use:
* play 1 wav file 1x
=play("c:\windows\media\ding.wav","ONCE")
* play it over and over until your head explodes!
=play("c:\windows\media\ding.wav","CONTINUOUS")
to make it stop
=play("c:\windows\media\ding.wav","STOP")
* play.prg - this procedure plays a .wav file using the windows API
*
* scott vandenelzen - scott@westonmedical.com
* weston medical data systems
*
* many thaks to david frankenburg for the details
*
*
parameters cValue, ; && path to the wav file you want to play
cMode && ONCE, CONTINUOUS, STOP
#DEFINE SND_SYNC 0x00
#DEFINE SND_ASYNC 0x01
#DEFINE SND_NODEFAULT 0x02
#DEFINE SND_LOOP 0x08
#DEFINE SND_NOSTOP 0x10
*******************************************************************************
* playit!
*******************************************************************************
DECLARE integer sndPlaySound in winmm.dll string cSoundName, integer uFlags
DO case
CASE m.cMode="ONCE"
=sndPlaySound( cValue, SND_ASYNC )
CASE m.cMode="CONTINUOUS"
=sndPlaySound( cValue, SND_ASYNC + SND_LOOP )
CASE m.cMode="STOP"
=sndPlaySound( .NULL. , SND_NODEFAULT)
OTHERWISE
=MsgBox("Unknown Parameter "+m.cMode+" in play.prg",16,"oh no!)
ENDCASE
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only