BYTE* pImageBuffer = NULL;
eResult res = PlayerLib::CreateImageSnapshot( iPlayerRef, eBMP, &pImageBuffer );
if( res > 0 )
{
.... // do something with the image
WriteFile(FileHandle, pBuffer, eRes, NULL, NULL);
ReleaseImageSnapshot( pImageBuffer ); // free the image buffer in not longer needed!
}
here i can receive the image data in pImageBuffer and i could do the some image process
the same way I have tryed in c# like
[DllImport("Pla开发者_JAVA百科yerLib")]
public static extern int CreateImageSnapshot(int iPlayerRef, eImageFormat imgFormat,byte[] ppImageBuffer);
byte[] bte ;
CreateImageSnapshot(iPlayerref,eImageFormat.ePNG,bte);
here its giving some unhandeld Exception..... hopefully the problem is in byte[] but i can't point out... please help me to overcome it.... thanks in advance
here it shoud return the imagedata in ppImageBuffer... but here it's giving zero byte only
My suggest to you would be to marshal BYTE **
as ref IntPtr
.
Your declaration would be:
[DllImport("PlayerLib")]
public static extern int CreateImageSnapshot(int iPlayerRef,
eImageFormat imgFormat, ref IntPtr ppImageBuffer);
P.S. and sorry for my English, guys ;)
One thing that looks off to me is your C# declaration of CreateImageSnapshot. Since your C++ code is correct, the third parameter must be a BYTE **. But in C# you have the third parameter as a byte[] which feels like an incompatible type.
精彩评论