由于C++中的DLL里的函数参数包含有的一些数据是VB里没有的,有RECT参数,pBitInfoHead指针和DecodeInfo指针, 请问怎么在VB中声明调用的函数

解决方案 »

  1.   

    Public Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
      

  2.   

    一般C的指针类型在VB中都以Long表示
      

  3.   

    VB定义类型为:
    Public Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
    End TypeType DecodeInfo
         full As Long
         ret As RECT
         codetxt As Long
         len As Long
         kind As Long
         way As Long
         reliability As Long
         DecodeInfo As Long
    End TypePublic Declare Function codeBar Lib "BarDll.dll" Alias "_codeBar@36" (ByVal pBitInfoHead As Long, ret As Any, ByVal gray As Long, ByVal EXT As Long, ByVal way As Long, ByVal barType As Long) As Long
    定义:
    Dim ret As RECT
    Dim m_DecodeInfo As DecodeInfo调用:
    lTag = codeBar(ImagePtr, ret, 150, m_39, 15, 1) 150, m_39, 15, 1)-----运行时出现约定错误,错误代码为49
    CopyMemory ByVal VarPtr(m_DecodeInfo), ByVal lTag, Len(m_DecodeInfo)