----海康摄像头对接
C#调用C++封装的DLL,如果C++里定义的是数组类型,C#在定义该字段的时候,需要加上[MarshalAs(UnmanagedType.ByValArray, SizeConst = 大小)]
比如:
struct{
DWORD dwSize;
NET_DVR_TIME_EX struStartTime;
NET_DVR_TIME_EX struEndTime;
DWORD dwEnterNum;
DWORD dwLeaveNum;
BYTE byRes[256];
}
转C#
public struct NET_DVR_PDC_RESULT
{
public int dwSize;
public NET_DVR_TIME_EX struStartTime;
public NET_DVR_TIME_EX struEndTime;
public int dwEnterNum;
public int dwLeaveNum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
public byte[] byRes;
}
----12/05/2015