Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

  • *Experts*
Posted

IntPtr is a structure that is basically a strongly-typed Integer.

It's 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 method's signature.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

oh ok...

well then lets say i've 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 ?

  • Administrators
Posted

You could pass the integer by reference to a sub or function

 

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]

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

well actually i'm trying to do a vertexbuffer rendering on CsGL. I need to pass in a IntPtr for my image buffer. I'm kindda stuck there so i thought it's 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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...