Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
API Call to ring system bell/play .WAV?
Message
 
À
06/09/1999 23:17:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00258772
Message ID:
00261852
Vues:
41
* Play a wave file using the Multimedia API
PROCEDURE PlayWavAPI
    LParam pcWavfile
    Local cShortPath, nSPathLen
    
    DECLARE INTEGER mciSendString IN WINMM ;
            STRING sendstr, INTEGER retstr, INTEGER szret, INTEGER callback
    DECLARE INTEGER GetShortPathName IN KERNEL32 ;
            STRING lpszLongPath, STRING lpszShortPath, INTEGER cchBuffer

    cShortPath = Replicate(chr(0),512)
    nSPathLen = GetShortPathName(Fullpath(pcWavfile), @cShortPath, 512)
    cShortPath = Left(cShortPath, nSPathLen)
    mciSendString("open "+cShortPath+ ;
                 " type waveaudio alias mmwav", 0, 0, 0)
    mciSendString("play mmwav wait", 0, 0, 0)
    mciSendString("close mmwav", 0, 0, 0)
ENDPROC
>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.
>

Just an opinion... Not a fact.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform