海康SDK 回调函数结束后出错
--HCNetSDK-- 单元
...
type
LPNET_DVR_ALARMER = ^NET_DVR_ALARMER;
NET_DVR_ALARMER=Record
byUserIDValid: Byte;
bySerialValid: Byte;
byVersionValid: Byte;
byDeviceNameValid: Byte;
byMacAddrValid: Byte;
byLinkPortValid: Byte;
byDeviceIPValid: Byte;
bySocketIPValid: Byte;
lUserID: LongInt;
sSerialNumber: Array [0..SERIALNO_LEN-1] of Byte;
dwDeviceVersion: LongInt;
sDeviceName: Array [0..NAME_LEN - 1] of char;
byMacAddr: Array [0..SERIALNO_LEN-1] of Byte;
wLinkPort: Word;
sDeviceIP: Array [0..127] of Char;
sSocketIP: Array [0..127] of Char;
byIpProtocol: Byte;
byRes2: Array [0..10] of Byte;
end;
type
LPNET_DVR_ALARMINFO = ^NET_DVR_ALARMINFO;
NET_DVR_ALARMINFO = record
dwAlarmType: LongInt;
dwAlarmInputNumber: LongInt;
dwAlarmOutputNumber: Array [0..MAX_ALARMOUT - 1] of LongInt;
dwAlarmRelateChannel: Array [0..MAX_CHANNUM - 1] of LongInt;
dwChannel: Array [0..MAX_CHANNUM - 1] of LongInt;
dwDiskNumber: Array [0..MAX_DISKNUM - 1] of LongInt;
end;
...
---UHCNetSdkDll--- 单元
type
TMessageCallback = procedure(lCommand:longint;pAlarmer:LPNET_DVR_ALARMER;pAlarmInfo:Pchar;dwBufLen:LongInt;pUser:pointer);
procedure NET_DVR_SetDVRMessageCallBack_V30(msgCallback:TMessageCallback;lUserID:pointer);stdcall;external 'HCNetSDK.dll';
---UTest---单元
var
Form1: TForm1;
procedure MessageCallBak(lCommand:longint;pAlarmer:LPNET_DVR_ALARMER;pAlarmInfo:Pchar;dwBufLen:LongInt;pUser:pointer);
implementation
{$R *.dfm}
procedure MessageCallBak(lCommand:longint;pAlarmer:LPNET_DVR_ALARMER;pAlarmInfo:Pchar;dwBufLen:LongInt;pUser:pointer);
var
I :Integer;
//struAlarmInfo: NET_DVR_ALARMINFO;
begin
showMessage(IntToStr(lCommand));
end;
[解决办法]
回调函数的调用约定加上stdcall试试
[解决办法]
回调要加stdcall的,不加不行的。