I want to convert c++ code to Delphi. The c++ code is getting stream from camera(Hikvision).I use a dll in my program, I am using this function in dll:
c++ code:
delphi code (that I convert):
That function needs callback function:
c++ code :
Delphi code(that I convert):
and use that callback function as a parameter in dll function:
c++ code:
delphi code (that I convert):
my c++ code is work completely correctly,but my delphi code can't call callback function.
c++ code:
Code:
NET_DVR_API LONG __stdcall NET_DVR_RealPlay_V30(LONG lUserID, LPNET_DVR_CLIENTINFO lpClientInfo, void(CALLBACK *fRealDataCallBack_V30) (LONG lRealHandle, DWORD dwDataType, BYTE *pBuffer, DWORD dwBufSize, void* pUser) = NULL, void* pUser = NULL, BOOL bBlocked = FALSE);
Code:
type
fRealDataCallBack_V30 =procedure(lRealHandle : LongInt; dwDataType: DWORD;pBuffer: PByte; dwBufSize: DWORD; dwUser: DWORD);stdcall;
function NET_DVR_RealPlay_V30 ( lUserID: Longint; lpClientInfo: LPNET_DVR_CLIENTINFO; fRealDataCallBack_V30: fRealDataCallBack_V30; pUser: Pointer; bBlocked: Boolean): Longint;stdcall; external 'HCNetSDK.dll'name 'NET_DVR_RealPlay_V30';
That function needs callback function:
c++ code :
Code:
void CALLBACK fRealDataCallBack(LONG lRealHandle, DWORD dwDataType, BYTE *pBuffer, DWORD dwBufSize, void* dwUser)
{
printf("\nhello");
}
Code:
procedure RealDataCallBack(lRealHandle: Longint; dwDataType: Longword; pBuffer: LPByte; dwBufSize: Longword; pUser:Pointer);stdcall;
begin
ShowMessage('hello');
end;
and use that callback function as a parameter in dll function:
c++ code:
Code:
NET_DVR_RealPlay_V30(lUserID,&client, fRealDataCallBack,NULL,false);
Code:
NET_DVR_RealPlay_V30(iLoginID,@lpClientInfo,RealDataCallBack,nil,false);
my c++ code is work completely correctly,but my delphi code can't call callback function.