Article # 412, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
What is a MemHandle?
Q. I used GrGetBitmap to save the background, but it returns a MemHandle. Where can I find the definition for MemHandle. And how to make use of the information returned by XYSize? A. GrGetBitmap returns a MemHandle to a newly allocated memory block containing the bitmap. The memory handle is an indirect reference to that memory block. A MemHandle is a very important type in GEOS; you really need to understand it to effectively develop GEOS applications. At a very basic level, a MemHandle is just a 16-bit value used to locate a memory block. Look in chapter 15 of the Concepts manual to get an in-depth discussion of memory management. To access the memory block, use MemLock(). This will restrict the block from being moved around in memory and return a pointer to the beginning of the block/bitmap. When you are finished accessing the block, use MemUnlock to allow the block to be movable again (the pointer to the block will now be invalid). When you have no more use for the memory block, will have to free the block with MemFree().