Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 6 - Component Manager / Component Manager Reference
Routines for Applications / Opening and Closing Components


The OpenComponent function allows your application to gain access to the services provided by a component. Your application must open a component before it can call any component functions. You specify the component with a component identifier that your application previously obtained from the FindNextComponent function.

Alternatively, you can use the OpenDefaultComponent function, as previously described, to open a component without calling the FindNextComponent function.

Note that your application may maintain several connections to a single component, or it may have connections to several components at the same time.

FUNCTION OpenComponent (aComponent: Component): ComponentInstance;
A component identifier that specifies the component to open. Your application obtains this identifier from the FindNextComponent function. If your application registers a component, it can also obtain a component identifier from the RegisterComponent or RegisterComponentResource function.
The OpenComponent function returns a component instance. The returned component instance identifies your application's connection to the component. You must supply this component instance whenever you call the functions provided by the component. When you close the component, you must also supply this component instance to the CloseComponent function.

If it cannot open the specfied component, the OpenComponent function returns a function result of NIL.

For examples of opening a specific component by using the FindNextComponent and OpenComponent functions, see Listing 6-1 on page 6-8 and Listing 6-2 on page 6-9, respectively. For a description of the FindNextComponent function, see page 6-40.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996