110,537
社区成员
发帖
与我相关
我的任务
分享
int WINAPI ecwOpenCallback( ECW_CALLBACK fCallback,
const char *szSvrIP=NULL,
long nPort = 7901,
const char *szAppName=NULL);
typedef long (__stdcall *ECW_CALLBACK)(WORD wEvent, WORD wIndex,const
LPECWATCHDATA lpecwData);
typedef struct {
WORD nState; //状态
WORD nIdx; //索引
WORD wDataCnt; //数据(lpData)项数
char szTime[20]; //时间
char* lpIDString; //设备号码
char* lpNameString; //设备/用户名称
char* lpData[8];
}ECWATCHDATA,*LPECWATCHDATA;
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
public struct ECWATCHDATA {
/// WORD->unsigned short
public ushort nState;
/// WORD->unsigned short
public ushort nIdx;
/// WORD->unsigned short
public ushort wDataCnt;
/// char[20]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst=20)]
public string szTime;
/// char*
public System.IntPtr lpIDString;
/// char*
public System.IntPtr lpNameString;
/// char*[8]
[System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=8, ArraySubType=System.Runtime.InteropServices.UnmanagedType.SysUInt)]
public System.IntPtr[] lpData;
}
typedef long (__stdcall *ECW_CALLBACK)(WORD wEvent, WORD wIndex,const
LPECWATCHDATA lpecwData);
对应C#委托
[System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention.StdCall)]
public delegate int ECW_CALLBACK(ushort wEvent, ushort wIndex, ref ECWATCHDATA lpecwData);