PRB: Passing and Discarding Handles in Windows
ID Number:  Q11689

2.00 3.00
WINDOWS


SYMPTOMS 
   If program A passes the handle of its own icon to program B
   and if A then terminates, B cannot continue to use the icon handle
   safely. If this icon is discardable, Windows cannot reload the icon
   properly if B tries to use it after A terminates.

CAUSE
   Icons are resources, resources are segments, and segments are
   global memory blocks. Global memory blocks are not equivalent to
   task handles; if a segment is discarded, Windows invalidates the 
   handle.

RESOLUTION 
   One alternative to passing the icon data handle is to use a
   shareable library or a property list for managing of data handles. Be
   careful, however. Other applications can use only shared, global 
   memory handles, such as GDI drawing objects. Applications share global
   memory handles through the Windows clipboard. Local memory handles
   cannot be shared. 
