ID Number: Q84473
1.00
WINDOWS
Summary:
Microsoft Professional Toolkit for Visual Basic version 1.0 includes a
custom Multimedia Device control called MCI (MCI.VBX). This control
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.
Below is an example of using the MCI control to play back a MIDI file.
This information applies to Microsoft Professional Toolkit for
Microsoft Visual Basic programming system version 1.0 for Windows.
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, or from the File menu, choose New Project (ALT,
F, N) if Visual Basic 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 F5 to run the program. Click on 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