vb调用Delphi编写的函数,回调函数的参数值不对(200分)

  • 主题发起人 主题发起人 huabinhong
  • 开始时间 开始时间
H

huabinhong

Unregistered / Unconfirmed
GUEST, unregistred user!
delphi DLL<br>type<br>&nbsp; TRx_Proc = procedure(a: integer; RecStr: PChar); safecall;<br>procedure DoCallTest(inStr: PChar; Rx_Proc: TRx_Proc); stdcall;<br>implementation<br>procedure DoCallTest(inStr: PChar; Rx_Proc: TRx_Proc); stdcall;<br>var<br>&nbsp; a: integer;<br>begin<br>&nbsp; a := 10;<br>&nbsp; Rx_Proc(a, inStr);<br>end;<br><br>vb 中调用<br>Public Declare Sub DoCallTest Lib "E:/LDS3100.dll" (ByVal inStr As String, ByVal Rx_Proc As Long)<br><br>Public Sub Rx_Proc(ByVal a As Long, ByVal RecStr As String) &nbsp;'回调函数<br>&nbsp; '处理数据<br>&nbsp; MsgBox CStr(a) + " " + RecStr<br>End Sub<br><br>上述函数中显示的RecStr的值不对,请问如何解决??
 
后退
顶部