Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
API Call to ring system bell/play .WAV?
Message
De
06/09/1999 23:17:55
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00258772
Message ID:
00261833
Vues:
32
Ramon,

Thanks for the code samples. The Multimedia API version works fine for me. I have a question, though - if the .WAV file is in a path that contains a space, will this function still work? I would suspect not.

I tried passing a fully qualified filename surrounded by single quotes (') but that didn't work. No error, but no sound either.

>This sample procedures don't have any error control,
>they only provide the basic.
>
>
>
>* Play a wave file using Microsoft Multimedia Control
>PROCEDURE PlayWavCtrl
>   LParam pcWavfile
>
>   Local loMMControl
>   loMMControl = CreateObject('MCI.MMControl')
>
>   loMMControl.DeviceType = 'WaveAudio'
>   loMMControl.Filename = FullPath(pcWavfile)
>   loMMControl.command='Open'
>   loMMControl.Wait = .t.
>   loMMControl.command='Play'
>   loMMControl.command='Close'
>
>   Release loMMControl
>ENDPROC
>
>* Play a wave file using the Multimedia API
>PROCEDURE PlayWavAPI
>    LParam pcWavfile
>    DECLARE INTEGER mciSendString IN WINMM ;
>            STRING sendstr, INTEGER retstr, ;
>            INTEGER szret, INTEGER callback
>
>    mciSendString("open "+Fullpath(pcWavfile)+ ;
>                 " type waveaudio alias mmwav", 0, 0, 0)
>    mciSendString("play mmwav wait", 0, 0, 0)
>    mciSendString("close mmwav", 0, 0, 0)
>ENDPROC
>
>
>
>>I need to be able to play .WAV files in my VFP 5 app. The combination of SET BELL TO "MySound.WAV", 0 and ??CHR(7) works perfectly at the VFP command window, but not within my app (based on Visual FoxExpress 5). No errors come up, the sound simply doesn't play.
>>
>>According to earlier threads, the problem may be in trying to use ??CHR(7) when a control incapable of accepting streaming output has the focus. As a workaround, Mark McCasland kindly posted an API call that reliably rings the bell. However, its "repertoire" seems to be limited to the Windows system sounds (e.g. DING.WAV), and it ignores the current VFP SET BELL setting.
>>
>>Is there another API call that could accept a .WAV file to play as a parameters? Or, can anyone think of a workaround? I think I'd prefer the API route if at all possible, because the .WAV files are called from a form method that is in turn called by a timer TimerEvent(), so I can't ever be sure which control will have the focus.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform