Pointers

Dark Kai

Well-known member
Joined
Sep 3, 2003
Messages
48
hi there, I was just wondering if this two are similar

C++
int *pointer

vb.net
dim pointer as intptr

BTW i dunno what is intptr. just know that it is suppose to be a pointer of some sort.
Thanks in advance.
 
IntPtr is a structure that is basically a strongly-typed Integer.
Its meant for storing things like window handles and procedure
addresses. It does not actually create a pointer that you can
play around with. If you need to pass a pointer of a variable to
a function, pass it regularly, but declare the parameter as ByRef
in the methods signature.
 
oh ok...
well then lets say ive a int variable Test

dim Test as integer

how do i get the address of this variable ?
and how do i pass it in to the IntPtr ?
 
You could pass the integer by reference to a sub or function

Code:
private sub DoThing(ByRef i as integer)

end sub

elsewhere you could use
dim Test as integer
DoThings(Test)    This would pass a reference to Test to the sub.

it may be easier if you give a better idea of what you are trying to do and why you feel you need pointers.
[/code]
 
well actually im trying to do a vertexbuffer rendering on CsGL. I need to pass in a IntPtr for my image buffer. Im kindda stuck there so i thought its better to understand IntPtr 1st.

I would also appreciate if u know about vertexbuffer couze i know near nothing about how to implement it.
thanks a lot.
 
Back
Top