Home > Back-end >  Hai kang equipment of NET_DVR_GetPlayBackOsdTime how to use this function in Delphi?
Hai kang equipment of NET_DVR_GetPlayBackOsdTime how to use this function in Delphi?

Time:09-15

Function: BOOL NET_DVR_GetPlayBackOsdTime (LONG lPlayHandle, LPNET_DVR_TIME lpOsdTime)
And count: [in] lPlayHandle
[out] lpOsdTime
Handle, NET_DVR_PlayBackByName or
The return value of a NET_DVR_PlayBackByTime_V40
A pointer to the OSD time get

Above is the well-being of the function of the manual, the following is a function of Delphi, excuse me var lpOsdTime: NET_DVR_TIME, what should I write?

The function NET_DVR_GetPlayBackOsdTime (lPlayHandle: LongInt;
Var lpOsdTime: NET_DVR_TIME) : BOOL; Stdcall; External 'HCNetSDK. DLL'


CodePudding user response:

 
Type
NET_DVR_TIME=record
DwYear dwMonth, dwDay dwHour, dwMinute, dwSecond: Cardinal;
The end;
LPNET_DVR_TIME=^ NET_DVR_TIME;

The function NET_DVR_GetPlayBackOsdTime (lPlayHandle: LongInt;
LpOsdTime: LPNET_DVR_TIME) : Boolean; Stdcall; External 'HCNetSDK. DLL';

CodePudding user response:

If you don't allow null pointer parameter lpOsdTime, using var parameters is more appropriate, of course, can also directly use pointer used varargs, incoming NET_DVR_TIME type variables can be,

CodePudding user response:

 
The function NET_DVR_GetPlayBackOsdTime (lPlayHandle: LongInt;
LpOsdTime: LPNET_DVR_TIME) : Boolean; Stdcall; External 'HCNetSDK. DLL';

And
 
The function NET_DVR_GetPlayBackOsdTime (lPlayHandle: LongInt;
Var lpOsdTime: NET_DVR_TIME) : Boolean; Stdcall; External 'HCNetSDK. DLL';

On the grammar of Delphi are completely equivalent, as the second said, however, the latter is better than the former, because the caller can be declared as local variables, call returns automatically after release, the memory efficiency, but also relatively safe,

CodePudding user response:

//use the first way, mainly considering keeping function definitions are consistent with the definition of c function, use the following: 
Var
PlayHandle: LongInt;
OsdTime: NET_DVR_TIME;
Rst: Boolean;
The begin
Rst:=NET_DVR_GetPlayBackOsdTime (PlayHandle, @ OsdTime);//the first way
//Rst:=NET_DVR_GetPlayBackOsdTime (PlayHandle OsdTime);//second way
The end;
//in fact two ways are equivalent, are OsdTime address,
//call there is no need to release the memory problems, in the process of
  • Related