Show: Delphi C++
Display Preferences

COM Object Wizard

From RAD Studio
Jump to: navigation, search

Go Up to File Menu

File > New > Other > ActiveX > COM Object

Use the New COM Object wizard to create a simple COM object such as a shell extension. Before you create a COM object, create or open the project for an application containing functionality that you want to implement. The project can be either a VCL application or an ActiveX library, depending on your needs.

Item Description

CoClass Name

Specify the class whose properties and methods you want to expose to client applications. This is the name of the CoClass. The implementation class has the same name with a T prepended.

Description

Enter a description for the COM object you are creating.

Threading Model

Choose the threading model to indicate how client applications can call your COM object's interface. The threading model you choose determines how the object is registered. You must make sure that your object implementation adheres to the model selected.

Instancing

Specify an instancing mode to indicate how your COM object is launched. When your COM object is used only as an in-process server, instancing is ignored.

Interface

Indicates the name of the COM object's default interface. By default, the COM object's interface is the same as the CoClass name, with an 'I' prepended. When you accept the default interface, your object gets a new interface that descends from IUnknown, which you can then define using the Type Library editor. You can change the default name of the interface by typing a name into the edit box. Instead of implementing a new interface, you can choose to have your object implement any dual or custom interface that is in a type library registered on your system. To choose the interface to implement, click the List button, which displays the Interface Selection wizard. Note that this wizard takes a bit of time to load because it must locate all interfaces that are defined in type libraries registered on your system. Note that you must use the Interface Selection wizard to implement an existing interface. If you type in the name of an existing interface, the wizard does not recognize this as an existing interface and assumes you are simply providing the object with a different interface name.

Include Type Library

(Delphi only) Check this box to generate a type library for this object. A type library contains type information that allows you to expose any object interface and its methods and properties to client applications. If you do not check this option, the Delphi compiler does not add {$ *.tlb} to your project source, and the generated .tlb file is not linked into your project.

Mark interface OleAutomation

Check this box to allow type library marshaling. This flag lets you avoid writing your own proxy-stub DLL for custom marshaling. When marking an interface as OleAutomation, you must ensure that it uses OLE Automation compatible types.

Implement existing interface [...]

If you want to implement an existing interface that is registered on your system, click [...] and select an available interface from the Interface Selection dialog box. After you select one of these interfaces, the check box for Implement Existing Interface is checked. When the wizard generates the code for the CoClass, it will implement the selected interface.

Generate Event support code

Check this box to tell the wizard to implement a separate interface for managing events on your Automation object. The separate interface has the name ICoClassNameEvents, and defines the event handlers that must be implemented by the client. Your application does not implement this interface.

See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance