Advertisement

04.25.2007 at 09:10AM PDT, ID: 22533547
[x]
Attachment Details

Help translating C to VB6

Asked by BitBreaker in C++ Programming Language, Miscellaneous Programming, Visual Basic Programming

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[lpMIDIHeader->dwOffset]);
            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
[+][-]04.25.2007 at 09:16AM PDT, ID: 18974942

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.25.2007 at 09:28AM PDT, ID: 18975049

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.25.2007 at 10:02AM PDT, ID: 18975342

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C++ Programming Language, Miscellaneous Programming, Visual Basic Programming
Sign Up Now!
Solution Provided By: EDDYKT
Participating Experts: 2
Solution Grade: C
 
 
[+][-]04.25.2007 at 10:13AM PDT, ID: 18975431

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.25.2007 at 11:40AM PDT, ID: 18976135

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.26.2007 at 03:26AM PDT, ID: 18980271

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32