Important: The information in this document is obsolete and should not be used for new development.
SetComponentInstanceStorage
When an application or component opens a connection to your component, the Component Manager sends your component an open request. In response to this open request, your component should set up an environment to service the connection. Typically, your component should allocate some memory for the connection. Your component can then use that memory to maintain state information appropriate to the connection.The
SetComponentInstanceStorage
procedure allows your component to pass a handle to this memory to the Component Manager. The Component Manager then provides this handle to your component each time the client application requests service from this connection.
PROCEDURE SetComponentInstanceStorage (aComponentInstance: ComponentInstance; theStorage: Handle);
aComponentInstance
- The connection to associate with the allocated memory. The Component Manager provides a component instance to your component when the connection is opened.
theStorage
- A handle to the memory that your component has allocated for the connection. Your component must allocate this memory in the current heap. The Component Manager saves this handle and provides it to your component, along with other parameters, in subsequent requests to this connection.
DESCRIPTION
TheSetComponentInstanceStorage
procedure associates the handle passed in the parametertheStorage
with the connection specified by theaComponentInstance
parameter. Your component should dispose of any allocated memory for the connection only in response to the close request.SPECIAL CONSIDERATIONS
Note that whenever an open request fails, the Component Manager
always issues the close request. Furthermore, the value stored withSetComponentInstanceStorage
is always passed to the close request, so
it must be valid orNIL
. If the open request tries to dispose of its allocated memory before returning, it should callSetComponentInstanceStorage
again with aNIL
handle to keep the Component Manager from passing an invalid handle to the close request.SEE ALSO
For an example that allocates memory in response to an open request, see Listing 6-6 on page 6-19.