Hi,
I've a little translation problem between C and VB, think someone here can help me easly :)
in C I got a little midisream programm that supports callback functionallty, I try to translate that in VB, but i stuck for the moment.
C:
have a structure within is a pointer to the data
myNotes is a array of onother structure
midiHdr.lpData = (LPBYTE)&myNotes[0];
the stream is calling then the callback
void CALLBACK cbfunc(HMIDIOUT handle, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
where dwParam1 i a pointer of the above midiHdr structure
you can then access the data the following way
LPMIDIHDR lpMIDIHeader;
MIDIEVENT * lpMIDIEvent;
lpMIDIHeader = (LPMIDIHDR)dwParam1;
This derefer the lpMIDIHeader access the data, and deliver the pointer of the current sequence in
the data.
lpMIDIEvent = (MIDIEVENT *)&(lpMIDIHeader->lpData[l
pMIDIHeade
r->dwOffse
t]);
now you can access the event structure like
lpMIDIEvent->.....
VB
midiHdr.lpData = VarPtr(notes(0))
Public Sub cbfunc(ByVal hMidiIn As Long, _
ByVal MessageType As Long, _
ByVal dwInstance As Long, _
ByVal dwParam1 As Long, _
ByVal dwParam2 As Long)
dim m as MIDIHDR
dim mv as MIDIEVENT
how can i fill here the structures back from dwParam1 pointer ???
hope for help ...
- Marc
Start Free Trial