lotus



previous page: 2.3) How do I dispose of Handles? (Memory - Mac Programming)
  
page up: Mac Programming FAQ
  
next page: 3.1) How do I read the modifier keys of the keyboard? (User / Machine interaction - Mac Programming)

2.4) What about resources? (Memory - Mac Programming)




Description

This article is from the Mac Programming FAQ, by Jon Watte h+@austin.metrowerks.com with numerous contributions by others.

2.4) What about resources? (Memory - Mac Programming)

Calling GetResource returns NULL if the resource is not found or
there is not enough memory, else it returns a handle to the resource.
This handle may be moved or locked like any other handle, but DO NOT
call DisposeHandle to get rid of a resource handle - call
ReleaseResource. DisposeResource (see above) will catch this kind of
bug.

Remember that AddResource makes a resource handle out of an ordinary
handle, and RemoveResource or DetachResource makes an ordinary handle
out of a resource handle. You cannot call AddResource with a resource
handle; you have to DetachResource it first.

Resource handles are automagically disposed when the resource file they
belong to is closed.

 

Continue to:















TOP
previous page: 2.3) How do I dispose of Handles? (Memory - Mac Programming)
  
page up: Mac Programming FAQ
  
next page: 3.1) How do I read the modifier keys of the keyboard? (User / Machine interaction - Mac Programming)