VC原型
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);
NET_DVR_API BOOL __stdcall NET_DVR_StopRealPlay(LONG lRealHandle);
我写成Delphi的
type fRealDataCallBack_V30=function(lRealHandle:Longint;dwDataType:DWORD;pBuffer:BYTE;dwBufSize:DWORD;pUser:Pointer): BOOL; stdcall;
function NET_DVR_RealPlay_V30(lUserID :longint ;lpClientInfo:LPNET_DVR_CLIENTINFO;RealDataCallBack_V30:fRealDataCallBack_V30;pUser:Pointer;bBlocked:BOOL):integer;stdcall; external 'HCNetSDK.dll' name 'NET_DVR_RealPlay_V30';
不知道这样正确否?
然后就不知道如何调用了,
5 个解决方案
#1
直接调用dll就可以,静态动态随便,不会的话,去google 函数名 NET_DVR_RealPlay_V30 之类,然后参数类型匹配正确
#2
转换函数的时候,类型要与C++中的类型一致。推荐使用万一博客中的类型参照表。
#3
把函数声明翻译一下就可以了。
#4
unit zHiKDefines;
interface
uses
Windows, Messages, SysUtils, Classes;
const
DEV_NO_CONNECT: LongInt = -1;
type
// DVR 设备描述块
TNetDVRDeviceInfo = packed record
sSerialNumber : array [0..SERIALNO_LEN - 1] of Char;
byAlarmInPortNum : Byte;
byAlarmOutPortNum: Byte;
byDiskNum : Byte;
byDVRType : Byte;
byChanNum : Byte;
byStartChan : Byte;
byAudioChanNum : Byte;
byIPChanNum : Byte;
byRes1 : array [1..24] of Char;
end;
// DVR 远程客户端描述块
TNET_DVR_CLIENTINFO = packed record
lChannel : LongInt;
lLinkMode : LongInt;
hPlayWnd : HWnd;
sMultiCastIP: PCHAR;
end;
// 报警记录体
TNET_DVR_ALARMINFO = packed record
dwAlarmOutputNumber: array [0..MAX_ALARMOUT - 1] of DWORD;
dwAlarmRelateChannel: array [0..MAX_CHANNUM - 1] of DWORD;
dwChannel: array [0..MAX_CHANNUM - 1] of DWORD;
dwDiskNumber: array [0..MAX_DISKNUM - 1] of DWORD;
end;
TNET_DVR_ALARMINFO_V30 = packed record
dwAlarmOutputNumber : array [0..MAX_ALARMOUT_V30 - 1] of Byte;
dwAlarmRelateChannel: array [0..MAX_CHANNUM_V30 - 1] of Byte;
dwChannel: array [0..MAX_CHANNUM_V30 - 1] of Byte;
dwDiskNumber: array [0..MAX_DISKNUM_V30 - 1] of Byte;
end;
TDvrAlarmInfoEx = packed record
dwAlarmType : DWORD;
dwAlarmInputNumber: DWORD;
case Integer of
0: (V2X: TNET_DVR_ALARMINFO);
1: (V30: TNET_DVR_ALARMINFO_V30);
end;
PDvrAlarmInfoEx = ^TDvrAlarmInfoEx;
TNET_DVR_ALARMER = packed 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 Char;
dwDeviceVersion : DWORD;
sDeviceName : array [0..NAME_LEN - 1] of Char;
byMacAddr : array [0..MACADDR_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;
PNET_DVR_ALARMER = ^TNET_DVR_ALARMER;
TNET_DVR_SCALECFG = packed record
dwSize: DWORD;
dwMajorScale: DWORD;
dwMinorScale: DWORD;
dwRes: array [0..1] of DWORD;
end;
//NET_DVR_IPPARACFG_V40 IP设备资源及IP通道资源配置结构体。
TNET_DVR_IPPARACFG_V40 = packed record
dwSize : DWORD;
dwGroupNum : DWORD;
dwAChanNum : DWORD;
dwDChanNum : DWORD;
dwStartDChan : DWORD;
end;
//PNET_DVR_IPPARACFG_V40 = ^TNET_DVR_IPPARACFG_V40;
TNET_DVR_PREVIEWINFO = packed record
lChannel : LongInt;
dwStreamType : DWORD;
dwLinkMode : DWORD;
hPlayWnd : HWND;
bBlocked : Boolean;
bPassbackRecord : Boolean;
byPreviewMode : BYTE;
byStreamID : array [0..STREAM_ID_LEN-1] of BYTE;
byProtoType : BYTE;
byRes : array [0..221] of BYTE;
end;
function NET_DVR_Init: Boolean; external 'HCNetSDK.dll';
function NET_DVR_Cleanup: Boolean; external 'HCNetSDK.dll';
function NET_DVR_GetLastError: DWORD; external 'HCNetSDK.dll';
function NET_DVR_SetDVRMessage(nMessage: Integer; MsgWnd: HWND): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_GetLocalIP(var Buf; var ValidNum: DWORD; var EnableBind: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetValidIP(dwIPIndex: DWORD; EnableBind: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetReconnect(dwInterval: DWORD; bEnableRecon: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
// 登入/登出功能
function NET_DVR_Login_V30(
sDVRIP : pChar;
wDVRPort : WORD;
sUserName : PChar;
sPassword : PChar;
var DeviceInfo: TNetDVRDeviceInfo): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_Logout_V30(lUserID: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
// 设备设置
function NET_DVR_GetDVRConfig(
lUserID : LongInt;
dwCommand : DWORD;
lChannel : LongInt;
var OutBuffer : TNET_DVR_IPPARACFG_V40;
dwOutBufferSize : DWORD;
var lpBytesReturned: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetDVRConfig(
lUserID : LongInt;
dwCommand : DWORD;
lChannel : LongInt;
lpInBuffer : Pointer;
dwInBufferSize: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
// 远程RS232 接口
function NET_DVR_SendTo232Port(
LUserID : DWORD;
pSendBuf : Pointer;
dwBufSize: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialStart(
lUserID : LongInt;
lSerialPort : LongInt;
cbSerialDataCallBack: Pointer;
dwUser : Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialSend(
lSerialHandle: LongInt;
lChannel : LongInt;
pSendBuf : Pointer;
dwBufSize : DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialStop(lSerialHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
// 实时视频
function NET_DVR_RealPlay_V30(
lUserID : LongInt;
var lpClientInfo : TNET_DVR_CLIENTINFO;
cbRealDataCallBack: Pointer; {nil}
pUser : Pointer; {nil}
bBlocked : Boolean {False}): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_RealPlay_V40(
lUserID : LongInt;
var lpPreviewInfo : TNET_DVR_PREVIEWINFO;
fRealDataCallBack_V30: Pointer;
pUser : Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StopRealPlay(lRealHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_GetScaleCFG_V30(lUserID: LongInt; var ScaleCfg: TNET_DVR_SCALECFG): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetScaleCFG_V30(lUserID: LongInt; var ScaleCfg: TNET_DVR_SCALECFG): Boolean;
stdcall; external 'HCNetSDK.dll';
// 报警检测
function NET_DVR_SetDVRMessageCallBack_V30(
fMessageCallBack: Pointer;
pUser: Pointer): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StartListen_V30(
sLocalIP: PCHAR;
wLocalPort: WORD;
DataCallback: Pointer;
pUserData: Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StopListen_V30(lListenHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetupAlarmChan_V30(lUserID: LongInt): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_CloseAlarmChan_V30(lAlarmHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
implementation
end.
interface
uses
Windows, Messages, SysUtils, Classes;
const
DEV_NO_CONNECT: LongInt = -1;
type
// DVR 设备描述块
TNetDVRDeviceInfo = packed record
sSerialNumber : array [0..SERIALNO_LEN - 1] of Char;
byAlarmInPortNum : Byte;
byAlarmOutPortNum: Byte;
byDiskNum : Byte;
byDVRType : Byte;
byChanNum : Byte;
byStartChan : Byte;
byAudioChanNum : Byte;
byIPChanNum : Byte;
byRes1 : array [1..24] of Char;
end;
// DVR 远程客户端描述块
TNET_DVR_CLIENTINFO = packed record
lChannel : LongInt;
lLinkMode : LongInt;
hPlayWnd : HWnd;
sMultiCastIP: PCHAR;
end;
// 报警记录体
TNET_DVR_ALARMINFO = packed record
dwAlarmOutputNumber: array [0..MAX_ALARMOUT - 1] of DWORD;
dwAlarmRelateChannel: array [0..MAX_CHANNUM - 1] of DWORD;
dwChannel: array [0..MAX_CHANNUM - 1] of DWORD;
dwDiskNumber: array [0..MAX_DISKNUM - 1] of DWORD;
end;
TNET_DVR_ALARMINFO_V30 = packed record
dwAlarmOutputNumber : array [0..MAX_ALARMOUT_V30 - 1] of Byte;
dwAlarmRelateChannel: array [0..MAX_CHANNUM_V30 - 1] of Byte;
dwChannel: array [0..MAX_CHANNUM_V30 - 1] of Byte;
dwDiskNumber: array [0..MAX_DISKNUM_V30 - 1] of Byte;
end;
TDvrAlarmInfoEx = packed record
dwAlarmType : DWORD;
dwAlarmInputNumber: DWORD;
case Integer of
0: (V2X: TNET_DVR_ALARMINFO);
1: (V30: TNET_DVR_ALARMINFO_V30);
end;
PDvrAlarmInfoEx = ^TDvrAlarmInfoEx;
TNET_DVR_ALARMER = packed 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 Char;
dwDeviceVersion : DWORD;
sDeviceName : array [0..NAME_LEN - 1] of Char;
byMacAddr : array [0..MACADDR_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;
PNET_DVR_ALARMER = ^TNET_DVR_ALARMER;
TNET_DVR_SCALECFG = packed record
dwSize: DWORD;
dwMajorScale: DWORD;
dwMinorScale: DWORD;
dwRes: array [0..1] of DWORD;
end;
//NET_DVR_IPPARACFG_V40 IP设备资源及IP通道资源配置结构体。
TNET_DVR_IPPARACFG_V40 = packed record
dwSize : DWORD;
dwGroupNum : DWORD;
dwAChanNum : DWORD;
dwDChanNum : DWORD;
dwStartDChan : DWORD;
end;
//PNET_DVR_IPPARACFG_V40 = ^TNET_DVR_IPPARACFG_V40;
TNET_DVR_PREVIEWINFO = packed record
lChannel : LongInt;
dwStreamType : DWORD;
dwLinkMode : DWORD;
hPlayWnd : HWND;
bBlocked : Boolean;
bPassbackRecord : Boolean;
byPreviewMode : BYTE;
byStreamID : array [0..STREAM_ID_LEN-1] of BYTE;
byProtoType : BYTE;
byRes : array [0..221] of BYTE;
end;
function NET_DVR_Init: Boolean; external 'HCNetSDK.dll';
function NET_DVR_Cleanup: Boolean; external 'HCNetSDK.dll';
function NET_DVR_GetLastError: DWORD; external 'HCNetSDK.dll';
function NET_DVR_SetDVRMessage(nMessage: Integer; MsgWnd: HWND): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_GetLocalIP(var Buf; var ValidNum: DWORD; var EnableBind: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetValidIP(dwIPIndex: DWORD; EnableBind: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetReconnect(dwInterval: DWORD; bEnableRecon: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
// 登入/登出功能
function NET_DVR_Login_V30(
sDVRIP : pChar;
wDVRPort : WORD;
sUserName : PChar;
sPassword : PChar;
var DeviceInfo: TNetDVRDeviceInfo): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_Logout_V30(lUserID: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
// 设备设置
function NET_DVR_GetDVRConfig(
lUserID : LongInt;
dwCommand : DWORD;
lChannel : LongInt;
var OutBuffer : TNET_DVR_IPPARACFG_V40;
dwOutBufferSize : DWORD;
var lpBytesReturned: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetDVRConfig(
lUserID : LongInt;
dwCommand : DWORD;
lChannel : LongInt;
lpInBuffer : Pointer;
dwInBufferSize: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
// 远程RS232 接口
function NET_DVR_SendTo232Port(
LUserID : DWORD;
pSendBuf : Pointer;
dwBufSize: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialStart(
lUserID : LongInt;
lSerialPort : LongInt;
cbSerialDataCallBack: Pointer;
dwUser : Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialSend(
lSerialHandle: LongInt;
lChannel : LongInt;
pSendBuf : Pointer;
dwBufSize : DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialStop(lSerialHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
// 实时视频
function NET_DVR_RealPlay_V30(
lUserID : LongInt;
var lpClientInfo : TNET_DVR_CLIENTINFO;
cbRealDataCallBack: Pointer; {nil}
pUser : Pointer; {nil}
bBlocked : Boolean {False}): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_RealPlay_V40(
lUserID : LongInt;
var lpPreviewInfo : TNET_DVR_PREVIEWINFO;
fRealDataCallBack_V30: Pointer;
pUser : Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StopRealPlay(lRealHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_GetScaleCFG_V30(lUserID: LongInt; var ScaleCfg: TNET_DVR_SCALECFG): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetScaleCFG_V30(lUserID: LongInt; var ScaleCfg: TNET_DVR_SCALECFG): Boolean;
stdcall; external 'HCNetSDK.dll';
// 报警检测
function NET_DVR_SetDVRMessageCallBack_V30(
fMessageCallBack: Pointer;
pUser: Pointer): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StartListen_V30(
sLocalIP: PCHAR;
wLocalPort: WORD;
DataCallback: Pointer;
pUserData: Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StopListen_V30(lListenHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetupAlarmChan_V30(lUserID: LongInt): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_CloseAlarmChan_V30(lAlarmHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
implementation
end.
#5
已搞定~~~~~~~~~~~~~~~~~~~~~~~
#1
直接调用dll就可以,静态动态随便,不会的话,去google 函数名 NET_DVR_RealPlay_V30 之类,然后参数类型匹配正确
#2
转换函数的时候,类型要与C++中的类型一致。推荐使用万一博客中的类型参照表。
#3
把函数声明翻译一下就可以了。
#4
unit zHiKDefines;
interface
uses
Windows, Messages, SysUtils, Classes;
const
DEV_NO_CONNECT: LongInt = -1;
type
// DVR 设备描述块
TNetDVRDeviceInfo = packed record
sSerialNumber : array [0..SERIALNO_LEN - 1] of Char;
byAlarmInPortNum : Byte;
byAlarmOutPortNum: Byte;
byDiskNum : Byte;
byDVRType : Byte;
byChanNum : Byte;
byStartChan : Byte;
byAudioChanNum : Byte;
byIPChanNum : Byte;
byRes1 : array [1..24] of Char;
end;
// DVR 远程客户端描述块
TNET_DVR_CLIENTINFO = packed record
lChannel : LongInt;
lLinkMode : LongInt;
hPlayWnd : HWnd;
sMultiCastIP: PCHAR;
end;
// 报警记录体
TNET_DVR_ALARMINFO = packed record
dwAlarmOutputNumber: array [0..MAX_ALARMOUT - 1] of DWORD;
dwAlarmRelateChannel: array [0..MAX_CHANNUM - 1] of DWORD;
dwChannel: array [0..MAX_CHANNUM - 1] of DWORD;
dwDiskNumber: array [0..MAX_DISKNUM - 1] of DWORD;
end;
TNET_DVR_ALARMINFO_V30 = packed record
dwAlarmOutputNumber : array [0..MAX_ALARMOUT_V30 - 1] of Byte;
dwAlarmRelateChannel: array [0..MAX_CHANNUM_V30 - 1] of Byte;
dwChannel: array [0..MAX_CHANNUM_V30 - 1] of Byte;
dwDiskNumber: array [0..MAX_DISKNUM_V30 - 1] of Byte;
end;
TDvrAlarmInfoEx = packed record
dwAlarmType : DWORD;
dwAlarmInputNumber: DWORD;
case Integer of
0: (V2X: TNET_DVR_ALARMINFO);
1: (V30: TNET_DVR_ALARMINFO_V30);
end;
PDvrAlarmInfoEx = ^TDvrAlarmInfoEx;
TNET_DVR_ALARMER = packed 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 Char;
dwDeviceVersion : DWORD;
sDeviceName : array [0..NAME_LEN - 1] of Char;
byMacAddr : array [0..MACADDR_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;
PNET_DVR_ALARMER = ^TNET_DVR_ALARMER;
TNET_DVR_SCALECFG = packed record
dwSize: DWORD;
dwMajorScale: DWORD;
dwMinorScale: DWORD;
dwRes: array [0..1] of DWORD;
end;
//NET_DVR_IPPARACFG_V40 IP设备资源及IP通道资源配置结构体。
TNET_DVR_IPPARACFG_V40 = packed record
dwSize : DWORD;
dwGroupNum : DWORD;
dwAChanNum : DWORD;
dwDChanNum : DWORD;
dwStartDChan : DWORD;
end;
//PNET_DVR_IPPARACFG_V40 = ^TNET_DVR_IPPARACFG_V40;
TNET_DVR_PREVIEWINFO = packed record
lChannel : LongInt;
dwStreamType : DWORD;
dwLinkMode : DWORD;
hPlayWnd : HWND;
bBlocked : Boolean;
bPassbackRecord : Boolean;
byPreviewMode : BYTE;
byStreamID : array [0..STREAM_ID_LEN-1] of BYTE;
byProtoType : BYTE;
byRes : array [0..221] of BYTE;
end;
function NET_DVR_Init: Boolean; external 'HCNetSDK.dll';
function NET_DVR_Cleanup: Boolean; external 'HCNetSDK.dll';
function NET_DVR_GetLastError: DWORD; external 'HCNetSDK.dll';
function NET_DVR_SetDVRMessage(nMessage: Integer; MsgWnd: HWND): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_GetLocalIP(var Buf; var ValidNum: DWORD; var EnableBind: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetValidIP(dwIPIndex: DWORD; EnableBind: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetReconnect(dwInterval: DWORD; bEnableRecon: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
// 登入/登出功能
function NET_DVR_Login_V30(
sDVRIP : pChar;
wDVRPort : WORD;
sUserName : PChar;
sPassword : PChar;
var DeviceInfo: TNetDVRDeviceInfo): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_Logout_V30(lUserID: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
// 设备设置
function NET_DVR_GetDVRConfig(
lUserID : LongInt;
dwCommand : DWORD;
lChannel : LongInt;
var OutBuffer : TNET_DVR_IPPARACFG_V40;
dwOutBufferSize : DWORD;
var lpBytesReturned: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetDVRConfig(
lUserID : LongInt;
dwCommand : DWORD;
lChannel : LongInt;
lpInBuffer : Pointer;
dwInBufferSize: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
// 远程RS232 接口
function NET_DVR_SendTo232Port(
LUserID : DWORD;
pSendBuf : Pointer;
dwBufSize: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialStart(
lUserID : LongInt;
lSerialPort : LongInt;
cbSerialDataCallBack: Pointer;
dwUser : Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialSend(
lSerialHandle: LongInt;
lChannel : LongInt;
pSendBuf : Pointer;
dwBufSize : DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialStop(lSerialHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
// 实时视频
function NET_DVR_RealPlay_V30(
lUserID : LongInt;
var lpClientInfo : TNET_DVR_CLIENTINFO;
cbRealDataCallBack: Pointer; {nil}
pUser : Pointer; {nil}
bBlocked : Boolean {False}): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_RealPlay_V40(
lUserID : LongInt;
var lpPreviewInfo : TNET_DVR_PREVIEWINFO;
fRealDataCallBack_V30: Pointer;
pUser : Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StopRealPlay(lRealHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_GetScaleCFG_V30(lUserID: LongInt; var ScaleCfg: TNET_DVR_SCALECFG): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetScaleCFG_V30(lUserID: LongInt; var ScaleCfg: TNET_DVR_SCALECFG): Boolean;
stdcall; external 'HCNetSDK.dll';
// 报警检测
function NET_DVR_SetDVRMessageCallBack_V30(
fMessageCallBack: Pointer;
pUser: Pointer): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StartListen_V30(
sLocalIP: PCHAR;
wLocalPort: WORD;
DataCallback: Pointer;
pUserData: Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StopListen_V30(lListenHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetupAlarmChan_V30(lUserID: LongInt): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_CloseAlarmChan_V30(lAlarmHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
implementation
end.
interface
uses
Windows, Messages, SysUtils, Classes;
const
DEV_NO_CONNECT: LongInt = -1;
type
// DVR 设备描述块
TNetDVRDeviceInfo = packed record
sSerialNumber : array [0..SERIALNO_LEN - 1] of Char;
byAlarmInPortNum : Byte;
byAlarmOutPortNum: Byte;
byDiskNum : Byte;
byDVRType : Byte;
byChanNum : Byte;
byStartChan : Byte;
byAudioChanNum : Byte;
byIPChanNum : Byte;
byRes1 : array [1..24] of Char;
end;
// DVR 远程客户端描述块
TNET_DVR_CLIENTINFO = packed record
lChannel : LongInt;
lLinkMode : LongInt;
hPlayWnd : HWnd;
sMultiCastIP: PCHAR;
end;
// 报警记录体
TNET_DVR_ALARMINFO = packed record
dwAlarmOutputNumber: array [0..MAX_ALARMOUT - 1] of DWORD;
dwAlarmRelateChannel: array [0..MAX_CHANNUM - 1] of DWORD;
dwChannel: array [0..MAX_CHANNUM - 1] of DWORD;
dwDiskNumber: array [0..MAX_DISKNUM - 1] of DWORD;
end;
TNET_DVR_ALARMINFO_V30 = packed record
dwAlarmOutputNumber : array [0..MAX_ALARMOUT_V30 - 1] of Byte;
dwAlarmRelateChannel: array [0..MAX_CHANNUM_V30 - 1] of Byte;
dwChannel: array [0..MAX_CHANNUM_V30 - 1] of Byte;
dwDiskNumber: array [0..MAX_DISKNUM_V30 - 1] of Byte;
end;
TDvrAlarmInfoEx = packed record
dwAlarmType : DWORD;
dwAlarmInputNumber: DWORD;
case Integer of
0: (V2X: TNET_DVR_ALARMINFO);
1: (V30: TNET_DVR_ALARMINFO_V30);
end;
PDvrAlarmInfoEx = ^TDvrAlarmInfoEx;
TNET_DVR_ALARMER = packed 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 Char;
dwDeviceVersion : DWORD;
sDeviceName : array [0..NAME_LEN - 1] of Char;
byMacAddr : array [0..MACADDR_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;
PNET_DVR_ALARMER = ^TNET_DVR_ALARMER;
TNET_DVR_SCALECFG = packed record
dwSize: DWORD;
dwMajorScale: DWORD;
dwMinorScale: DWORD;
dwRes: array [0..1] of DWORD;
end;
//NET_DVR_IPPARACFG_V40 IP设备资源及IP通道资源配置结构体。
TNET_DVR_IPPARACFG_V40 = packed record
dwSize : DWORD;
dwGroupNum : DWORD;
dwAChanNum : DWORD;
dwDChanNum : DWORD;
dwStartDChan : DWORD;
end;
//PNET_DVR_IPPARACFG_V40 = ^TNET_DVR_IPPARACFG_V40;
TNET_DVR_PREVIEWINFO = packed record
lChannel : LongInt;
dwStreamType : DWORD;
dwLinkMode : DWORD;
hPlayWnd : HWND;
bBlocked : Boolean;
bPassbackRecord : Boolean;
byPreviewMode : BYTE;
byStreamID : array [0..STREAM_ID_LEN-1] of BYTE;
byProtoType : BYTE;
byRes : array [0..221] of BYTE;
end;
function NET_DVR_Init: Boolean; external 'HCNetSDK.dll';
function NET_DVR_Cleanup: Boolean; external 'HCNetSDK.dll';
function NET_DVR_GetLastError: DWORD; external 'HCNetSDK.dll';
function NET_DVR_SetDVRMessage(nMessage: Integer; MsgWnd: HWND): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_GetLocalIP(var Buf; var ValidNum: DWORD; var EnableBind: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetValidIP(dwIPIndex: DWORD; EnableBind: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetReconnect(dwInterval: DWORD; bEnableRecon: Boolean): Boolean;
stdcall; external 'HCNetSDK.dll';
// 登入/登出功能
function NET_DVR_Login_V30(
sDVRIP : pChar;
wDVRPort : WORD;
sUserName : PChar;
sPassword : PChar;
var DeviceInfo: TNetDVRDeviceInfo): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_Logout_V30(lUserID: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
// 设备设置
function NET_DVR_GetDVRConfig(
lUserID : LongInt;
dwCommand : DWORD;
lChannel : LongInt;
var OutBuffer : TNET_DVR_IPPARACFG_V40;
dwOutBufferSize : DWORD;
var lpBytesReturned: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetDVRConfig(
lUserID : LongInt;
dwCommand : DWORD;
lChannel : LongInt;
lpInBuffer : Pointer;
dwInBufferSize: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
// 远程RS232 接口
function NET_DVR_SendTo232Port(
LUserID : DWORD;
pSendBuf : Pointer;
dwBufSize: DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialStart(
lUserID : LongInt;
lSerialPort : LongInt;
cbSerialDataCallBack: Pointer;
dwUser : Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialSend(
lSerialHandle: LongInt;
lChannel : LongInt;
pSendBuf : Pointer;
dwBufSize : DWORD): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SerialStop(lSerialHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
// 实时视频
function NET_DVR_RealPlay_V30(
lUserID : LongInt;
var lpClientInfo : TNET_DVR_CLIENTINFO;
cbRealDataCallBack: Pointer; {nil}
pUser : Pointer; {nil}
bBlocked : Boolean {False}): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_RealPlay_V40(
lUserID : LongInt;
var lpPreviewInfo : TNET_DVR_PREVIEWINFO;
fRealDataCallBack_V30: Pointer;
pUser : Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StopRealPlay(lRealHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_GetScaleCFG_V30(lUserID: LongInt; var ScaleCfg: TNET_DVR_SCALECFG): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetScaleCFG_V30(lUserID: LongInt; var ScaleCfg: TNET_DVR_SCALECFG): Boolean;
stdcall; external 'HCNetSDK.dll';
// 报警检测
function NET_DVR_SetDVRMessageCallBack_V30(
fMessageCallBack: Pointer;
pUser: Pointer): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StartListen_V30(
sLocalIP: PCHAR;
wLocalPort: WORD;
DataCallback: Pointer;
pUserData: Pointer): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_StopListen_V30(lListenHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_SetupAlarmChan_V30(lUserID: LongInt): LongInt;
stdcall; external 'HCNetSDK.dll';
function NET_DVR_CloseAlarmChan_V30(lAlarmHandle: LongInt): Boolean;
stdcall; external 'HCNetSDK.dll';
implementation
end.
#5
已搞定~~~~~~~~~~~~~~~~~~~~~~~