vb调用DELPHI写的动态库问题
function MXReadFingerFromSensor(FingerBufchar):Boolean; stdcall; external 'JLZD02.DLL'\\DELPHI中的函数
VB中的代码:
Public Declare Function drjw Lib "JLZD02.DLL" Alias "MXReadFingerFromSensor" (ByVal Pchar As String) As Boolean
Private Sub Command5_Click()
   dim s as string
   s = String(255, vbNullChar)
   If (drjw(s) = False) Then
      MsgBox "读入失败!"
   Else
      MsgBox "读入成功!"
   End If
End Sub程序运行后,提示内存读取错误,然后自动关闭VB,问题出在哪啊,高手帮帮忙吧,弄了一天也没解决啊!!!!

解决方案 »

  1.   

    这样试试
    If (drjw(strptr(s)) = False) Then
     
      

  2.   

    Public Declare Function drjw Lib "JLZD02.DLL" Alias "MXReadFingerFromSensor" (ByVal Pchar As String) As Long看下你的文档中有关Pchar缓冲区的要求。
      

  3.   

    以上两种的方法都行不通,第一种仍然提示内存读取错误,第二种在释放设备的时候提示内存读取错误!
    delphi中是这样定义的:
    var
      FingerBuf:Array[0..303,0..255] of char;
    函数是这样的:function MXReadFingerFromSensor(FingerBuf:Pchar):Boolean; stdcall; external 'JLZD02.DLL'哪位帮忙解决一下吧!急死我了!!!!!
      

  4.   

    原来是个二维数组,难怪呢你这样试试Public Declare Function drjw Lib "JLZD02.DLL" Alias "MXReadFingerFromSensor" (Pchar As Any) As Long
    Private Sub Command5_Click() 
       dim chars(303,255) as byte
       If (drjw(chars(0,0) = False) Then 
          MsgBox "读入失败!" 
       Else 
          MsgBox "读入成功!" 
       End If 
    End Sub