Results 1 to 3 of 3

Thread: vb .net and API - Pointers

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    13

    vb .net and API - Pointers

    I need to get a pointer to a variable i have declared so i can pass it to a structure(that is being passed to a api function)

    Is this the best method do so?

    VB Code:
    1. Dim intvalue as Integer = 32
    2.  
    3. Dim GC As System.Runtime.InteropServices.GCHandle = System.Runtime.InteropServices.GCHandle.Alloc(intValue, System.Runtime.InteropServices.GCHandleType.Pinned)
    4.  
    5. Dim ret As Integer = GC.AddrOfPinnedObject.ToInt32
    6.  
    7. GC.Free()

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I doubt you can do this in VB .

  3. #3
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148
    I'd use <MarshalAs() > in your API declaration and let the system deal with all that stuff...

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