Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42220

How to get poniter of array in Variant

$
0
0
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

Viewing all articles
Browse latest Browse all 42220

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>