A
Ant?nio Calado Lopes
Hi all, I need to marshal this struc. I have an object of this type
that goes as an argument in a dll to which i dont have source code
acess. here is the struc in c++
struct _TSNAPINFO {
UCHAR resolution;
UCHAR quality;
TCHAR filename[100];
int inbufferlen;
unsigned char *imgbuff;
int *outbufferlen;
}
Im trying to declare it in C# as
public class _TSNAPINFO
{
public byte resolution = 0;
public byte quality = 0;
public StringBuilder filename;
public int inbufferlen = 0;
public byte[] imgbuff = null;
public IntPtr outbufferlen;
}
Im declaring the fucntion that needs it as :
[DllImport("SDIOCam",SetLastError=true)]
public static extern bool SDIOCamSnapShot(IntPtr hCam, ref
_TSNAPINFO snapshotinfo);
everytime I call it i get a unsupported exception which is due to the
parameter snapshotinfo for sure. the problem is in marshalling the
structure. Can someone help me out?
thanks in advance
Antonio Calado Lopes
that goes as an argument in a dll to which i dont have source code
acess. here is the struc in c++
struct _TSNAPINFO {
UCHAR resolution;
UCHAR quality;
TCHAR filename[100];
int inbufferlen;
unsigned char *imgbuff;
int *outbufferlen;
}
Im trying to declare it in C# as
public class _TSNAPINFO
{
public byte resolution = 0;
public byte quality = 0;
public StringBuilder filename;
public int inbufferlen = 0;
public byte[] imgbuff = null;
public IntPtr outbufferlen;
}
Im declaring the fucntion that needs it as :
[DllImport("SDIOCam",SetLastError=true)]
public static extern bool SDIOCamSnapShot(IntPtr hCam, ref
_TSNAPINFO snapshotinfo);
everytime I call it i get a unsupported exception which is due to the
parameter snapshotinfo for sure. the problem is in marshalling the
structure. Can someone help me out?
thanks in advance
Antonio Calado Lopes