RAD Studio |  |

Adding a CoClass to the Type Library
See Also
Collapse All

The easiest way to add a CoClass to your project is to choose FileNewOther 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 can't add members directly to a CoClass. Instead, you implicitly add members when you add an interface to the CoClass.
See Also

Adding an Interface to the Type Library

Code Generated by Wizards

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!