VERSION 5.00 Begin VB.Form Form1 Caption = "Form1" ClientHeight = 3105 ClientLeft = 25380 ClientTop = 11265 ClientWidth = 4680 LinkTopic = "Form1" ScaleHeight = 3105 ScaleWidth = 4680 End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False ' mOUSmUSO 2.0 ' 06 Feb 2002 Private Declare Function midiOutClose Lib "winmm.dll" (ByVal hMidiOut As Long) As Long Private Declare Function midiOutOpen Lib "winmm.dll" (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long Private Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long Dim hMidiOut As Long Dim hMidiOutCopy As Long Dim gridnote As Integer Sub Form_Load() midiOutClose hMidiOut ' Just in case X% = midiOutOpen(hMidiOut, -1, 0&, 0&, 0&) If X% = 0 Then hMidiOutCopy = hMidiOut MidiOK = True Else midiOutClose hMidiOut End If End Sub Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) gridnote = Int((X / 6) + Int(Y / 8)) / 8 ' Generate note from x,y pos 'gridnote = Int(126 * Rnd) + 1 ' for auto Fn later If gridnote > 127 Then gridnote = 127 ' restrict to legal MIDI val SendMidiOut 144, gridnote, 100 End Sub Sub SendMidiOut(MidiEventOut%, MidiNoteOut%, MidiVelOut%) lowint& = (MidiNoteOut% * 256) + MidiEventOut% VelOut& = MidiVelOut% * 256 highint& = VelOut& * 256 MidiMessage& = lowint& + highint& X% = midiOutShortMsg(hMidiOutCopy, MidiMessage&) End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) SendMidiOut 144, gridnote, 0 End Sub 'Sub Form_Unload(Cancel As Integer) ' X% = midiOutClose(hMidiOutCopy) 'End Sub