Home > Back-end >  Please put a c # code, translated into Delphi
Please put a c # code, translated into Delphi

Time:12-08

[DllImport (" mmtools. DLL ", CallingConvention=CallingConvention Cdecl)]
Public static extern void WxSetDeviceInfo (int pWorker, tagDeviceInfo [] pDeviceInfo);


Public struct tagDeviceInfo
{
Public string ostype;
Public string devicebrand;

}


List List=new List (a);
TagDeviceInfo dev=new tagDeviceInfo ();

List. Add (dev);
WxSetDeviceInfo (worker, list ToArray ());

CodePudding user response:

This mmtools itself is written in Delphi, from CallingConvention=CallingConvention. Cdecl this statement, mmtools. DLL should be done to Delphi version secondary packaging, and call in c #, true enough around, so you'd better look for Delphi version directly source code, there should be a demo can refer to,

In terms of the statement, so roughly:

Type
TagDeviceInfo=record
Ostype: string;
Devicebrand: string;
end;

Procedure WxSetDeviceInfo (pWorker: integer; PDeviceInfo: an array of tagDeviceInfo); Cdecl. External 'mmtools. DLL';

Procedure test.
Var
Worker: integer;
Dev: an array of tagDeviceInfo;
The begin
Worker:=0;//whether to initialise can try
SetLength (dev, 1);
WxSetDeviceInfo (worker, dev);
end;

CodePudding user response:

Call the mmtools WxSetDeviceInfo of DLL,

Upstairs
  • Related