Home > Back-end >  VC SDK secondary development transformation of Delphi
VC SDK secondary development transformation of Delphi

Time:09-17

VC code conversion Delphi


VC definition:
//open the brake parameter (corresponding DH_CTRL_OPEN_STROBE command)
Typedef struct tagNET_CTRL_OPEN_STROBE
{
DWORD dwSize;
Int nChannelId;//channel number
Char szPlateNumber [MAX_PLATENUMBER_LEN];//license plate number
} NET_CTRL_OPEN_STROBE;

//device control function prototype
CLIENT_API BOOL CALL_METHOD CLIENT_ControlDevice (LLONG lLoginID, CtrlType type, void * param, int waittime=1000).

VC code:
NET_CTRL_OPEN_STROBE stuAccessPara={sizeof (stuAccessPara)};
StuAccessPara. NChannelId=thisVideo. Index;
Bool bret=CLIENT_ControlDevice (thisVideo. LoginID DH_CTRL_OPEN_STROBE, & amp; StuAccessPara);

Delphi definition:
Type
LPNET_CTRL_OPEN_STROBE=^ NET_CTRL_OPEN_STROBE;
NET_CTRL_OPEN_STROBE=record
DwSize: DWORD;
NChannelId: Integer;
SzPlateNumber: Array [0.. 1] 40 of Char;
end;

//device control
The Function CLIENT_ControlDevice (lLoginID: LongInt; CtrlType: tCtrlType; Param: Pointer; Const waittime: integer=1000) : Boolean; Stdcall External 'dhnetsdk';

Var
Aa: LPNET_CTRL_OPEN_STROBE;
Rest: Boolean;
The begin
AA:=New (LPNET_CTRL_OPEN_STROBE);
Aa. DwSize:=sizeof (NET_CTRL_OPEN_STROBE);
Aa. NChannelId:=0;
//aa. SzPlateNumber:='ABCD';
Rest:=CLIENT_ControlDevice (devHandle DH_CTRL_OPEN_STROBE, AA);
If Rest then
Memo1. Lines. The Add (' opened success ')
The else
Memo1. Lines. The Add (' breaking failure)
end;

CLIENT_ControlDevice function is not an error, but also do not return the correct results

CodePudding user response:

LLONG is defined as what, perhaps is a long long?

CodePudding user response:

LLONG lLoginID this definition into a lLoginID: LongInt: no problem

CodePudding user response:

May be a problem so several, data types, calling convention, the structure is aligned...
  • Related