Adding a CoClass to the Type Library

From RAD Studio
Jump to: navigation, search

Go Up to Using the Type Library Editor

The easiest way to add a CoClass to your project is to choose File > New > Other from the main menu in the IDE and use the appropriate wizard on the ActiveX page of the New Items dialog. The advantage to this approach is that, in addition to adding the CoClass and its interface to the type library, the wizard adds an implementation unit and updates the project file to include the new implementation unit in its uses clause.

If you are not using a wizard, however, you can create a CoClass by clicking the CoClass icon on the toolbar and then specifying its attributes. You will probably want to give the new CoClass a name (on the Attributes page), and may want to use the Flags page to indicate information such as whether the CoClass is an application object, whether it represents an ActiveX control, and so on.

Note: When you add a CoClass to a type library using the toolbar instead of a wizard, you must generate the implementation for the CoClass yourself and update it by hand every time you change an element on one of the CoClass' interfaces.

You cannot add members directly to a CoClass. Instead, you implicitly add members when you add an interface to a CoClass.

See Also