Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Playing sound in OLE Control - how?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00212291
Message ID:
00212381
Views:
25
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
Map
View

Click here to load this message in the networking platform