The OpenDefaultComponent, and CloseComponent functions allow your application to gain access to and release components. Your application must open a component before it can use the services provided by that component. Similarly, your application must close the component when it is finished using the component.
You can use the OpenDefaultComponent function to open a component of a specified component type and subtype.
Once you are finished using a component, use the CloseComponent function to release the component.
The OpenDefaultComponent 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 type and subtype values of the component to open. The Component Manager searches for a component that meets those criteria. If you want to exert more control over the selection process, you can use the FindNextComponent and OpenComponent functions.
FUNCTION
OpenDefaultComponent (componentType as String, componentSubType as String) as ComponentInstance
The OpenDefaultComponent function searches its list of registered components for a component that meets the search criteria. If it finds a component that matches the search criteria, OpenDefaultComponent opens a connection to the component and 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 more than one component in the list of registered components meets the search criteria, OpenDefaultComponent opens the first one that it finds in its list.
If it cannot open the specfied component, the OpenDefaultComponent function returns a function result of NIL .
The CloseComponent function terminates your application's access to the services provided by a component. Your application specifies the connection to be closed with the component instance returned by the OpenComponent or OpenDefaultComponent function.
CloseComponent
aComponentInstance as ComponentInstance
The CloseComponent function closes only a single connection. If your application has several connections to a single component, you must call the CloseComponent function once for each connection.