如何传递数组到DLL,
如何传递数组到DLL,DLL中接受数组,对这些数组元素处理后,再返回另外一个数组?最好有没有例子程序呢〉? --------------------编程问答-------------------- VB传出BYTE()指针及长度
DLL返回指针及长度,VB再用COPYMEMORY复制 --------------------编程问答--------------------
'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 Explicit
Private 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
要的是不是这个? --------------------编程问答-------------------- 用指针数组的方式,简单的说就是按地址传递参数。 --------------------编程问答-------------------- 出差了,回来试下,谢谢各位
补充:VB , 基础类