Hi
I am developing a wrapper for a C++ SDK DLL built for a video capture
card. After opening all channels on the card i call the function
StartVideoCapture(IntPtr channelHandle) what is supposed to happen after
that is that when the data stream is reday the DLL should raise an event
through a callback that i have registerd with the DLL. In that function
i can then access the data stream. The problem is just that the C++ Dll
uses void* pointers and i havenīt got the slightest clue on how to
Marshal that. I have the full source code of a C++ demo project and all
the DLL specifications. The function specs in the DLL lokks like this:
1.
typedef int (*STREAM_DIRECT_READ_CALLBACK)(ULONG channelNumber,void
*DataBuf,DWORD Length,int FrameType,void *context);
2.
DLLEXPORT_API int __stdcall
RegisterStreamReadCallback(STREAM_READ_CALLBACK StreamReadCallback, void
*Context);
I have tried with something like this but with no luck.
public delegate short STREAM_DIRECT_READ_CALLBACK( uint
channelNumber,[MarshalAs(UnmanagedType.IUnknown)]object DataBuf,uint
Length,int FrameType,[MarshalAs(UnmanagedType.IUnknown)]object Context);
[DllImport("DsSdk.dll", CharSet=CharSet.Ansi)]
public static extern short
RegisterStreamDirectReadCallback(STREAM_DIRECT_REA D_CALLBACK
StreamDirectReadCallback,[MarshalAs(UnmanagedType.IUnknown)]object
Context);
And then:
RegisterStreamDirectReadCallback(new
STREAM_DIRECT_READ_CALLBACK(this.StreamDirectReadC allback),
this.Handle);
But it keeps crashing hard every time i try to run it.
I have struggeld with this for a while now and desperatly need help..
/Henrik Pedersen
Sweden
*** Sent via Developersdex
http://www.developersdex.com ***