Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Sub Form_Load()
ReDim a(1 To 10) As Long
For w = 1 To 10
a(w) = w
Next
Debug.Print VarPtr(a(1)), Q(a)
' Error solution: Q(a) <> VarPtr(a(1))
' Positive solution: how to let Q(a) solution Equal VarPtr(a(1))
End Sub
Function Q(ar) As Long
Q = VarPtr(ar(1))
' purpose of the Problem is the following
Redim ar_2(1 to 10) as long
call CopyMemory ( varptr(ar_2(1)) , Q , 40)
End Function
Private Sub Form_Load()
ReDim a(1 To 10) As Long
For w = 1 To 10
a(w) = w
Next
Debug.Print VarPtr(a(1)), Q(a)
' Error solution: Q(a) <> VarPtr(a(1))
' Positive solution: how to let Q(a) solution Equal VarPtr(a(1))
End Sub
Function Q(ar) As Long
Q = VarPtr(ar(1))
' purpose of the Problem is the following
Redim ar_2(1 to 10) as long
call CopyMemory ( varptr(ar_2(1)) , Q , 40)
End Function