Copyright © 2005-2018 MultiMedia Soft

OnMidiKeyboardEvents event

Previous pageReturn to chapter overviewNext page



Occurs when one of the keys on the virtual piano keyboard, previously created through the MIDI.KeyboardCreate method, is pressed or released.


This event replaces the usage of the CallbackForMidiKeyboardEvents delegate and is only intended for usage with applications developed using Visual Basic 6 (which results unreliable when dealing with delegates and callbacks) and, in order to be enabled, requires a call to the COMEventsEnable method.


For further details about callback delegates see the How to synchronize the container application with the API tutorial.

For further details about the use of MIDI protocol see the MIDIMan class section and the How to deal with MIDI protocol tutorial.





[Visual Basic 6]

Private Sub DjStudioApi_OnMidiKeyboardEvents ( _

ByVal hWndKeyboard as IntPtr, _

ByVal nNote as Int16, _

ByVal bPressed as Boolean, _

ByVal bSimulated as Boolean _



where "DjStudioApi" is declared in Visual Basic 6 code as:


Dim WithEvents DjStudioApi As AudioDjStudioApi.AudioDjStudioApiObj



Event Data







Handle of the virtual keyboard as returned by the call to the MIDI.KeyboardCreate method


Note played through pressure of one of the keys of the virtual piano keyboard. Can be a key number from 0 to 127; 60 means middle C


Boolean flag that specifies if the key was pressed or released.

Supported values are the following:




The key was released


The key was pressed


Boolean flag that specifies if the key pressure is simulated. When the key pressure is simulated, the key appears pressed on the piano keyboard but no real event is generated on the MIDI stream in playback, allowing to display a note played through an external physical MIDI keyboard attached to one of the MIDI input channels.

Supported values are the following:




The note was played on the MIDI stream in playback


The note was not played on the MIDI stream in playback but the corresponding key was rendered as pressed on the piano keyboard.