VB3 How to Play MIDI Files Using API Calls from Visual BasicID: Q99898
|
This article demonstrates how to play a MIDI (.MID) file from Visual Basic
using Windows version 3.1 APIs.
If you have the Professional Edition of Visual Basic version 2.0 or 3.0, or
if you have the Professional Toolkit for Visual Basic version 1.0, you can
use the MCI control to play a MIDI file. You don't need to use the APIs
DIM ret as Integer
'*** The following will open the sequencer with the CANYON.MID
'*** file. Canyon is the device_id. Enter the entire statement on one,
'*** single line.
ret = mciSendString("open CANYON.MID type sequencer alias canyon",
0&, 0, 0)
'*** The wait tells the MCI command to complete before returning control
'*** to the application.
Ret = mciSendString("play canyon wait", 0&, 0, 0)
'*** Close CANYON.MID file and sequencer device
Ret = mciSendString("close canyon", 0&, 0, 0)
' Enter the following Declare statement on one, single line:
Declare Function mciSendString Lib "mmsystem" (ByVal lpstrCommand$,
ByVal lpstrReturnStr As Any, ByVal wReturnLen%, ByVal hCallBack%)
As Long
Additional query words: 2.00 3.00
Keywords : kbWndw
Version : 1.00 2.00 3.00
Platform : WINDOWS
Issue type :
Last Reviewed: June 17, 1999