VB回调DLL,其中有回调函数如何处理?
DLL是DELPHI写的。
delphi里抛出的方法是 SetUpLoad (funcA :TfuncA)
我在VB的写法是:
- VB code
Declare Sub SetUpLoad Lib "East.Dll" (ByVal funcA As Long) 声明函数Public Sub funcA(Dev_id As Integer, serial As String, ip As String) ‘回调函数 以下是简单代码 Mainform.ClockID.Text = Dev_id Mainform.serial.Text = serial Mainform.ip.Text = ip End Sub call SetUpLoad(AddressOf SetUpLoad) ‘调用函数
运行的时候,程序没有反映,不知道我这样写错在那里,哪位大哥可以指点一下!谢谢。
[解决办法]
- VB code
Type myREC CardID As Long EmpID As Long time As LongEnd Type'建议你用longDeclare Function GetThree Lib "MyLib.dll" (FmyREC As long) As LongConst LONG_SIZE = 4Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ (lpDestination As Any, _ lpSource As Any, _ ByVal lLength As Long)Dim vCardId As LongDim vEmpId As LongDim vTime As LongDim vMyPtr As LongDim vRc As LongvRc = GetThree(vMyPtr)Dim FmyRec(0 To 2) As myRECCopyMemory FmyRec, ByVal vMyPtr, LONG_SIZE
[解决办法]