Home > Back-end >  Ask a dynamic library declaration problem, c # statement into DELPHI statement
Ask a dynamic library declaration problem, c # statement into DELPHI statement

Time:09-19

For a long time didn't have the DELPHI, there is a small program, manufacturers for c # statement, forgot, the translation of some type, universal group of friends of the help of

 
[DllImport (" RdCard. DLL)]
Extern static int UCommand1 (System. Byte [] pCmd, ref int parg0, ref int parg1, ref int parg2);

This statement
 
The function UCommand (pCmd: PByte; Var Parg0: Integer; Var Parg1: Integer; Var Parg2: Integer) : Integer; Stdcall; External 'RdCard. DLL';


TByte=array [0.. 0] of Byte; This statement pbyte wrong?

CodePudding user response:

 function TForm1. InitCom (nPort: Integer; The out Msg: string) : BOOL; 
Var
CMD: an array of Byte;
Para0 para1, para2: Integer;
Ret: Integer;
The begin
SetLength (CMD + 1);
CMD [0] :=$41.
Para0:=0;
Para1:=8811;
Para2:=9986;

Ret:=UCommand (@ CMD, para0, para1, para2);

If (ret=62171) or (ret=5) or (ret=7) then
The begin
Msg:='success';
Result:=True;
//Timer1. Enabled:=True;
End the else
The begin
Msg:='false';
Result :=False;
end;
end;


This call is wrong

CodePudding user response:

Ret:=UCommand (@ CMD [0], para0, para1, para2);
In addition, Pascal support similar statement:
The function UCommand (pCmd: PByte; Var Parg0 Parg1, Parg2: Integer) : Integer; Stdcall; External 'RdCard. DLL';
  • Related