VB引入VC写的ocx控件,接口一个是指针地址,一个是长度,如何传进数组的地下,我用数组0不怎么呢

解决方案 »

  1.   


    long AddLongs_Pointer(long *plArrayOfLongs, long lElements);   Declare Function AddLongs_Pointer Lib "MyDll.dll" (FirstElement As Long,
       ByVal lElements As Long) As Long
       Dim MyArrayOfLongs(0 to 10) as Long
       Dim lTotal as Long
       lTotal = AddLongs_Pointer (MyArrayOfLongs(0), UBound(MyArrayOfLongs) + 1)
      

  2.   

    这是接口:
    long IRI(long* Templates, long DatabaseSize)//这是我部传入代码
        Do While Not adoRst.EOF
              s = adoRst.Fields("Template").GetChunk(1024)
               sBtyT = s
            
               ReDim Preserve sBty(1024 * (i + 1) - 1)
            
              CopyMemory sBty(1024 * i), sBtyT(0), 1024
              i = i + 1
            
            adoRst.MoveNext
        Loop
     End If
    lp = VarPtr(sBty(0))
    lpp = VarPtr(lp)Call IRISVideoPlay1.IRISVideoMatch(lpp, i)怎么不可能呢
      

  3.   

    VarPtr是任何非数组、类成员的变量数组在VB默认的就是引用你再仔细看看我上面发的声明和使用
      

  4.   

    你声明的数组类型是long型
    但是我数据库保存的全是二进制数据,所我想全部取出来,放到内存中,然后把内存的首地址传给VC接口。所以我用数组类型是byte。如果接品直接输入Call IRISVideoPlay1.IRISVideoMatch(byte(0), i)
    会提示类型不匹配. 
      

  5.   

    http://download.csdn.net/source/1371398看看这本书,上面有关于数组的内容,应该对你有帮助
      

  6.   

    lpp 在哪里声明的?另外,你直接传数组的首地址就对了,不用那么取来取去。