如何传递数组到DLL,
DLL中接受数组,对这些数组元素处理后,再返回另外一个数组?最好有没有例子程序呢〉?

解决方案 »

  1.   

    VB传出BYTE()指针及长度
    DLL返回指针及长度,VB再用COPYMEMORY复制
      

  2.   


    'dll:
    Option Explicit
    '一个过程
    Public Sub tt(a() As Long)    Dim i As Long
        For i = LBound(a) To UBound(a)
            a(i) = a(i) * i
        Next
        
    End Sub'一个函数
    Public Function ttt(a() As Long) As String()    Dim i As Long
        
        ReDim aa(LBound(a) To UBound(a)) As String
        For i = LBound(a) To UBound(a)
            aa(i) = a(i) * i
        Next
        ttt = aa
        
    End Function'程序窗口
    Option ExplicitPrivate Sub Command1_Click()
        
        Dim o As Object
        Dim a(10) As Long
        Dim i As Long
        
        For i = 0 To 10
            a(i) = i
        Next
        
        Set o = CreateObject("工程1.class1")
        Call o.tt(a)   '这个过程改写了a
        
        MsgBox Join(o.ttt(a), vbCrLf)  '这个函数返回了一个新数组
          
    End Sub
    要的是不是这个?