![]() |
CallComponentFunctionWithStorage |
||||
Header: | Components.h | Carbon status: | Supported | |
Invokes the specified function of your component.
SInt32 CallComponentFunctionWithStorage ( Handle storage, ComponentParameters *params, ComponentFunctionUPP func );
A handle to the memory associated with the current connection. The Component Manager provides this handle to your component along with the request.
A pointer to the ComponentParameters structure that your component received from the Component Manager. These are the parameters originally provided by the application that called your component.
A universal procedure pointer to the component function that is to handle the request. The Component Manager calls the function referred to by the func parameter, using Pascal calling conventions, with the parameters that were originally provided by the application that called your component. These parameters are preceded by a handle to the memory associated with the current connection. The function referred to by the func parameter must return a function result of type ComponentResult indicating the success or failure of the operation. See the ComponentRoutineProcPtr callback for more information on component functions.
The value that is returned by the function referred to by the func parameter. Your component should use this value to set the current error for this connection. Use the SetComponentInstanceError function to set the current error for a connection.
When an application requests service from your component, your component receives a component parameters structure containing the parameters that the application provided when it called your component. Your component can use this structure to access the parameters directly. Alternatively, you can use either the CallComponentFunction function or this function to extract those parameters and pass them to a subroutine of your component. By taking advantage of these functions, you can simplify the structure of your component code.
If your component subroutine requires a handle to the memory associated with the connection, you must use this function. You allocate the memory for a given connection each time your component is opened. You inform the Component Manager that a connection has memory associated with it by calling the SetComponentInstanceError function.
Subroutines of a component that dont need global data should use CallComponentFunction instead.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)