Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
API Call to ring system bell/play .WAV?
Message
 
To
06/09/1999 23:17:55
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00258772
Message ID:
00261852
Views:
40
* 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.
Previous
Reply
Map
View

Click here to load this message in the networking platform