Hi,
I'm trying to use the MIDIInProc callback function associated with the
MIDIInOpen multimedia API function. Here are the function prototypes I'm
using:
Declare Function midiInOpen Lib "winmm.dll" (ByVal lphMidiIn As Integer,
ByVal uDeviceID As Integer, ByVal dwCallback As MIDIProcDelegate, ByVal
dwInstance As Integer, ByVal dwFlags As Integer) As Integer
Delegate Sub MIDIProcDelegate(ByVal hDlg As Integer, ByVal Msg As Integer,
ByVal wInstance As Integer, _
ByVal wParam As Integer, ByVal lParam As Integer)
If I make the following call:
mMIDIInProcDelegate = AddressOf MIDICallback.MessageProc
iRtn = midiInOpen(mhMidiIn, MIDIInputDeviceID, mMIDIInProcDelegate, 0,
CALLBACK_FUNCTION)
the device opens without error and the target method is actually called when
incoming MIDI data is received. However the data is incorrect.
As a cross-check if I call MidiInOpen with the CALLBACK_WINDOW flag set and
then forward the received data in the window's Wndproc to the target method
the same data is correctly received.
Incidentally the target method is contained in a module and no system calls
are made whilst the message is processed.
Unless there's something wrong with the function prototypes the only other
glitch must be in marshalling the calls or data. Any insights would be much
appreciated. BTW, I'm running framework v1.1.
Thanks for any help
Jon
jon morgan - 06 Jun 2005 20:28 GMT
I've figured this out for myself : the message data is packed differently
depending on whether you are using CALLBACK_WINDOW or CALLBACK_FUNCTION.
Nice !
Regards
Jon
> Hi,
>
[quoted text clipped - 33 lines]
>
> Jon