Hi, I have the following function that I need to call from C#.
HRESULT CamPreviewGetBGR16(HANDLE hCamera,LPBYTE pBuffer);
but I am stuggling with the LPBYTE pBuffer. I have decalred it as
[DllImport("mobilecamapi.dll",EntryPoint="CamPreviewGetBGR16")]
public static extern int CamPreviewGetBGR16(uint hCamera, byte[] pBuffer);
and have called it via:
byte[] buffer = new byte[width * height * 2];
result = CamPreviewGetBGR16(cameraHandle, buffer);
It is returning with a missing method exception. I think the 'byte[]
pBuffer' in the API definition needs to be a 'uint pBuffer' but then how do
I convert the 'byte[] buffer' in the calling code to be a uint? (I am a bit
of a novice at all of this Interop stuff)
Any suggestions are greatly appreaciated.
Thanks
Dave A
Xedecimal - 02 Jan 2005 08:11 GMT
Dug around a bit for lpbyte and C# and found some information on it...
System.Runtime.InteropServices.Marshal.CopyBytesToManaged(Int32 source,
Byte[] destination, Int32 startIndex, Int32 length)
Not sure but it looks to be what will make you a managed lpbyte array, also
if you have too much trouble with this dll, there's avicap32.dll that I
always used to do webcam things with.
> Hi, I have the following function that I need to call from C#.
>
[quoted text clipped - 20 lines]
>
> Dave A
Dave A - 02 Jan 2005 13:42 GMT
Thanks! That looks like the answer.
This is for the Pocket PC. I don't think avicap32.dll will work.
Regards
Dave
> Dug around a bit for lpbyte and C# and found some information on it...
>
[quoted text clipped - 29 lines]
> >
> > Dave A