Results 1 to 9 of 9

Thread: How to get poniter of array in Variant

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2009
    Posts
    13

    How to get poniter of array in Variant

    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
    Last edited by quickcccc; Sep 1st, 2012 at 12:32 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width