Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2005

Tip: Looking for answers? Try searching our database.

Marshalling Problem with MIDIInProc

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jon morgan - 06 Jun 2005 15:14 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.