VB MCI Control Does Not Support Recording of MIDI Data

Last reviewed: June 21, 1995
Article ID: Q84473
The information in this article applies to:

- Professional Edition of Microsoft Visual Basic for Windows,

  versions 2.0 and 3.0
- Microsoft Professional Toolkit for Microsoft Visual Basic programming
  system for Windows, version 1.0

SUMMARY

The Multimedia Device control called MCI (MCI.VBX), consists of a set of high level, device-independent commands that control audio and visual peripherals. However, the MCI control cannot record standard MIDI (Musical Instrument Data Interface) input. This is a limitation of the MCI control, not of Visual Basic for Windows.

Below is an example of using the MCI control to play back a MIDI file.

MORE INFORMATION

The MCI custom control can play back MIDI files if you have the necessary hardware and software installed. Typically, you need a sound board that supports MIDI and Windows, version 3.1 to use the MCI control to play back MIDI files. Windows 3.1 or (Windows 3.0 with Multimedia Extensions version 1.0) supplies MIDI drivers for several well-known hardware add-on boards that support MIDI.

The following is an example of using the MCI control to play back a MIDI file called TEST.MID.

  1. Run Visual Basic for Windows, or from the File menu, choose New Project (press ALT, F, N) if Visual Basic for Windows is already running. Form1 is created by default.

  2. From the File menu, choose Add File. In the Files box, select the MCI.VBX custom control file. The MCI tool appears in the Toolbox.

  3. Add the following code to the Form_Load event procedure:

          Sub Form_Load ()
            MMControl1.PlayVisible = -1
            MMControl1.StopVisible = -1
            MMControl1.FileName = "c:\midi\bach.mid"
            MMControl1.Wait = -1
            MMControl1.DeviceType = "sequencer"
            MMControl1.Command = "open"
          End Sub
    
    

  4. Add the following code to your Form_Unload event procedure:

          Sub Form_Unload (Cancel As Integer)
            MMControl1.Command = "close"
          End Sub
    
    

  5. Press the F5 key to run the program. Click the play arrow of the MCI control to play the MIDI file.

NOTE: An MIDI file may play, but may not be audible due to MIDI configuration issues such as the MIDI channel and instrument.


Additional reference words: 1.00 2.00 3.00
KBCategory: kbprg kbcode
KBSubcategory: PrgCtrlsCus


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: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.