How to Play Audio CDs from Visual FoxPro

Last reviewed: April 30, 1996
Article ID: Q131632
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0

SUMMARY

This article shows by example how to play an audio compact disc (CD) using Visual FoxPro.

MORE INFORMATION

The following example registers the Windows Multi-Media DLL file (WINMM.DLL) by using the DECLARE command. WINMM.DLL contains the MciSendString system function that accepts parameters to allow you to manipulate media files and devices.

Step-by-Step Example

  1. Create a new form and enter the following code in the Init section of the form:

       #define mmsystem "WINMM.DLL"
       DECLARE integer mciSendString IN mmsystem string, string, integer,;
          integer
       =mciSendString("open cdaudio","",0,0)
    
    

  2. Add a command button to the form, and set its Caption property to Play. Enter the following code in the Click event of the button:

    =mciSendString("play cdaudio","",0,0)

  3. Add another command button to the form, and set its Caption property to Stop. Enter the following code in the Click event of the button:

    =mciSendString("stop cdaudio","",0,0)

  4. Add another command button to the form, and set its Caption property to Eject. Enter the following code in the Click event of the button:

    =mciSendString("set cdaudio door open","",0,0)

  5. Add a final command button to the form, and set its Caption property to Exit. Enter the following code in the Click event of the button:

    CLEAR DLLS RELEASE THISFORM

  6. Press the exclamation mark (!) button on the Visual FoxPro toolbar, and enter a name for the form.


Additional reference words: 3.00 VFoxWin CD-ROM sound music
KBCategory: kbsound
KBSubcategory: FxotherSound


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.