Home > Back-end >  Trouble master to help me to check the wrong, how will a VB statement into the DELPHI code
Trouble master to help me to check the wrong, how will a VB statement into the DELPHI code

Time:11-16

VB code
Function declaration
Private Declare Function WriteDataMulti Lib "VestoreForVb. DLL" (sPointName () As String, ByRef dValue As Double, ByRef lTime As Long, ByVal lCount As Long) As Long
Dim lTag (2) As String
Dim lValue (2) As a Double
Dim lTime (2) As Long
LTag (0)="a"
LTag (1)="b"
LTag (2)="c"

LValue (0)=123
LValue (1)=234
LValue (2)=345

LTime (0)=fCalDateLong (Now)
LTime (1)=fCalDateLong (Now)
LTime (2)=fCalDateLong (Now)

If WriteDataMulti (lTag (), lValue (0), lTime (0), 3)=1 Then
MsgBox (" success ")
End the If
In VB with normal


DELPHI code
The function WriteDataMulti (sPointName: pointer; Var dValue: double; Var lTime: longint; LCount: longint) : longint; Stdcall; External libname;

LTag: an array of string;
LValue: an array of double;
LTime: an array of longint;
Of the three arrays and use setlength assignment
Ret:=WriteDataMulti (@ lTag, @ lValue [0], @ lTime [0], count);
The result error, suggesting Extenal exception E0607363 such mistakes, I have checked the three arrays are set up the correct data
Doubt statement or call wrong, master, please give directions, online, etc.,

CodePudding user response:

Function of c + + prototype is
Int _stdcall WriteDataMulti (SAFEARRAY * * psPointName, double * dValue, long * lTime, long count)
Everybody to help me see how to call just normal,

CodePudding user response:

reference 1st floor yangtou response:
c + + function prototype is
Int _stdcall WriteDataMulti (SAFEARRAY * * psPointName, double * dValue, long * lTime, long count)
Everybody to help me see how to call just normal,


USES WinApi. ActiveX;

The function WriteDataMulti (var psPointName: PSafeArray; Var dValue: double; Var lTime: longint; Count: longint) : integer; Stdcall; External 'VestoreForVb. DLL';
  • Related