

You might want to check out the MIDI reference on the MSDN website for in-depth information for details on the different functions.īelow, I highlighted the parts that took me a while to figure out:

Midi monitor error code#
The source code is rather self-explanatory. Object, e As System.EventArgs) _īutton3.Text = " Show System messages" Elseīutton3.Text = " Hide System messages" End If End Sub Private Sub Form1_FormClosed( ByVal sender As Object, _īyVal e As ) Handles Me.FormClosed Object, e As System.EventArgs) _īutton2.Text = " Start monitor" End If End Sub Private Sub Button3_Click(sender As System. Object, e As System.EventArgs) _Įnd Sub Private Sub Button2_Click(sender As System. MidiInOpen(hMidiIn, DeviceID, ptrCallback, 0, CALLBACK_FUNCTION Or MIDI_IO_STATUS)īutton2.Text = " Stop monitor" End Sub Private Sub Button1_Click(sender As System. Object, _Į As System.EventArgs) Handles ComboBox1.SelectedIndexChangedĬomboBox1.Enabled = False Dim DeviceID As Integer = ComboBox1.SelectedIndex MidiInGetDevCaps(DevCnt, InCaps, Len(InCaps))Įnd Sub Private Sub ComboBox1_SelectedIndexChanged(sender As System. StatusByte, DataByte1, DataByte2, vbCrLf))Įnd If End Sub Private Sub Form1_Load( ByVal sender As Object, _īyVal e As System.EventArgs) Handles Me.Loadĭim DevCnt As Integer For DevCnt = 0 To (midiInGetNumDevs - 1) TextBox1.AppendText( String.Format( " ", _ If ((HideMidiSysMessages = True) And ((dwParam1 And &HF0) = &HF0)) Then Exit Sub ElseĭataByte2 = (dwParam1 And &HFF0000) > 16 TextBox1.Invoke( New DisplayDataDelegate( AddressOf DisplayData), _Įnd If End Function Private Sub DisplayData(dwParam1)
Midi monitor error driver#
Public Delegate Sub DisplayDataDelegate(dwParam1)ĭim wMid As Int16 ' Manufacturer ID Dim wPid As Int16 ' Product ID Dim vDriverVersion As Integer ' Driver versionĭim szPname As String ' Product Name Dim dwSupport As Integer ' Reserved End Structure Dim hMidiIn As Integer Dim StatusByte As Byte Dim DataByte1 As Byte Dim DataByte2 As Byte Dim MonitorActive As Boolean = False Dim HideMidiSysMessages As Boolean = False Function MidiInProc( ByVal hMidiIn As Integer, _īyVal dwParam1 As Integer, ByVal dwParam2 As Integer) As Integer If MonitorActive = True Then

Public Const CALLBACK_FUNCTION As Integer = &H30000 ( ByRef hMidiIn As Integer, ByVal uDeviceID As Integer, _īyVal dwCallback As MidiInCallback, ByVal dwInstance As Integer, _īyVal dwFlags As Integer) As Integer Public Declare Function midiInStart Lib " winmm.dll" ( ByVal hMidiIn As Integer) As Integer Public Declare Function midiInStop Lib " winmm.dll" ( ByVal hMidiIn As Integer) As Integer Public Declare Function midiInReset Lib " winmm.dll" ( ByVal hMidiIn As Integer) As Integer Public Declare Function midiInClose Lib " winmm.dll" ( ByVal hMidiIn As Integer) As Integer Public Delegate Function MidiInCallback( ByVal hMidiIn As Integer, _īyVal wMsg As UInteger, ByVal dwInstance As Integer, _īyVal dwParam1 As Integer, ByVal dwParam2 As Integer) As Integer Public ptrCallback As New MidiInCallback( AddressOf MidiInProc) Public Declare Function midiInGetNumDevs Lib " winmm.dll" () As Integer Public Declare Function midiInGetDevCaps Lib " winmm.dll" _Īlias " midiInGetDevCapsA" ( ByVal uDeviceID As Integer, _īyRef lpCaps As MIDIINCAPS, ByVal uSize As Integer) As Integer Public Declare Function midiInOpen Lib " winmm.dll" _
