[futurebasic] Re: [FB] Handles and pointers

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1999 : Group Archive : Group : All Groups

From: Chris Henkel <fblist@...>
Date: Wed, 22 Sep 1999 10:21:06 +0200
Hi Sylvain,

what I would do:

>1)
>How do i create a pointer to an handle created with NEWHANDLE ?
>Is it just: HandlePtr& = @MyHandle ?

- lock the handle (FN HLOCK) and use it as a pointer.

>2)
>How can i find out the size of the handle using just the pointer ? 
>(with GETHANDLESIZE)

- use FN GETHANDLESIZE
- I dont know, if FN GETPTRSIZE would also work with a locked handle...

>3)
>Also, by just using the pointer, how can i, for example, read the 12th byte in
>the handle ?

- lock the handle
- PEEK into it or
- BLOCKMOVE the bytes you want to read

>4)
>How do i put, for example, 200 in the 12th byte of a handle ? (not 
>using a pointer)

- depends on how "200" is delivered (what kind of var):
- lock the handle
- BLOCKMOVE the data into it
- in case, the data is longer than the data you want to replace, you 
might want to copy the data from the handle into another handle until 
you reach the position, where you want to insert the new data, insert 
it, then copy the rest of the first handle into the second...

>PS: I've always had problems with pointers and handles. I think 
>there should be
>a tutorial or a FAQ-Sheet on these. Just a suggestion...

Rick has written a couple of easy understandable pages about this 
subject - I just dont know where to look for them ;o)

And in Frank Turovich's second book on FutureBASIC you will also find 
every information regarding handles and pointers you might need.

Btw: the above is 'what I would do' and might be completely off...

chris

--
=> http://www.bytesatwork.com <= we are here
=> http://www.futurebasic.org <= you should have been there
=> http://www.webring.org/cgi-bin/webring?ring=fb123;list