Delphi makes it easier to write COM server applications by providing wizards that handle many of the details involved. Delphi provides separate wizards to create the following:
The COM object wizard also provides an implementation for IDispatch if you specify that you are creating an object that supports an IDispatch descendant.
For Automation and Active Server objects, the wizard implements IUnknown and IDispatch, which provides automatic marshaling.
For ActiveX control objects and ActiveX forms, the wizard implements all the required ActiveX control interfaces, from IUnknown, IDispatch, IOleObject, IOleControl, and so on. For a complete list of interfaces, see the reference page for TActiveXControl object.
The following table lists the various wizards and the interfaces they implement:
Delphi wizards for implementing COM, Automation, and ActiveX objects
Wizard |
Implemented interfaces |
What the wizard does |
IUnknown (and IDispatch if you select a default interface that descends from IDispatch) |
Exports routines that handle server registration, class registration, loading and unloading the server, and object instantiation. Creates and manages class factories for objects implemented on the server. Provides registry entries for the object that specify the selected threading model. Declares the methods that implement a selected interface, providing skeletal implementations for you to complete. Provides a type library, if requested. Allows you to select an arbitrary interface that is registered in the type library and implement it. If you do this, you must use a type library. | |
IUnknown, IDispatch |
Performs the tasks of a COM server wizard (described above), plus: Implements the interface that you specify, either dual or dispatch. Provides server-side support for generating events, if requested. Provides a type library automatically. | |
COM+ Event object |
None, by default |
Creates a COM+ event object that you can define using the Type Library editor. Unlike the other object wizards, the COM+ Event object wizard does not create an implementation unit because event objects have no implementation (it is provided by event subscriber objects). |
None, by default |
Creates a new type library and associates it with the active project. | |
ActiveX library |
None, by default |
Creates a new ActiveX or Com server DLL and exposes the necessary export functions. |
You can add additional COM objects or reimplement an existing implementation. To add a new object, it is easiest to use the wizard a second time. This is because the wizard sets up an association between the type library and an implementation class, so that changes you make in the type library editor are automatically applied to your implementation object.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|