Mattias
Sun Aug 31 06:47:34 CDT 2003
Logan,
>I found the answer,
>use GCHandle, code sample follows
>----------------------------------------------------------------------------
>-------------
>//b is the byte array
>//ToSend is an IntPtr that is set to the address of b
>GCHandle gch = GCHandle.Alloc(b,GCHandleType.Pinned);
>ToSend = gch.AddrOfPinnedObject();
>----------------------------------------------------------------------------
>-------------
Just don't forget to Free the GCHandle when you're done with it.
Another possible solution is to change the DLL function declaration to
take a byte array parameter instead of an IntPtr.
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.