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
Data Structures for Applications


Component Identifiers and Component Instances

In general, when using Component Manager routines, your application must specify the particular component using either a component identifier or component instance.
The Component Manager identifies each component by a component identifier. The Component Manager identifies each instance of a component by a component instance. Thus, when your application searches for a component with a particular type and subtype using the FindNextComponent function, FindNextComponent returns a component identifier that identifies the component. Similarly, your application specifies a component identifier to the GetComponentInfo function to obtain information
about a component.

When you open a connection to a component, the OpenDefaultComponent and OpenComponent functions return a component instance. The returned component instance identifies that specific instance of the component. If you open the same component again, the Component Manager returns a different component instance. So a component has a single component identifier and can have multiple component instances. To use a component function, your application specifies a component instance.

Although conceptually component identifiers and component instances
serve different purposes, Component Manager routines (with the exception of DelegateComponentCall) allow you to use component identifiers and component instances interchangeably. If you do this, you must always coerce the data type appropriately.

A component identifier is defined by the data type Component:

TYPE
   {component identifier}
   Component         = ^ComponentRecord;
   ComponentRecord   = 
   RECORD
      data: ARRAY[0..0] OF LongInt;
   END;
A component instance is defined by the data type ComponentInstance:

TYPE
   {component instance}
   ComponentInstance = ^ComponentInstanceRecord;
   ComponentInstanceRecord = 
   RECORD
      data: ARRAY[0..0] OF LongInt;
   END;

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996