RAD Studio VCL Reference
TActiveXControl Class

TActiveXControl is an abstract class that provides the functionality to embed a VCL control into an ActiveX Container window.

TActiveXControl = class(TAutoObject, IConnectionPointContainer, IDataObject, IObjectSafety, IOleControl, IOleInPlaceActiveObject, IOleInPlaceObject, IOleObject, IPerPropertyBrowsing, IPersistPropertyBag, IPersistStorage, IPersistStreamInit, IQuickActivate, ISimpleFrameSite, ISpecifyPropertyPages, IViewObject, IViewObject2);
class TActiveXControl : public TAutoObject, public IConnectionPointContainer, public IDataObject, public IObjectSafety, public IOleControl, public IOleInPlaceActiveObject, public IOleInPlaceObject, public IOleObject, public IPerPropertyBrowsing, public IPersistPropertyBag, public IPersistStorage, public IPersistStreamInit, public IQuickActivate, public ISimpleFrameSite, public ISpecifyPropertyPages, public IViewObject, public IViewObject2;

TActiveXControl defines the core behavior and interfaces required of an ActiveX control and connects that behavior to any VCL control derived from TWinControl. This allows the control to be embedded in any ActiveX container, including Internet Explorer, Visual Basic, PowerBuilder, Paradox, CodeGear C++, IntraBuilder and, of course, Delphi. 

To create a new ActiveX control class, use the ActiveX control wizard. The steps for building an ActiveX control are covered in the Developer's Guide or in the online help document, Developing COM-based applications. 

The TActiveXControl class is derived from TAutoObject, therefore the object resulting is a COM object that supports COM-based Automation, a type library, and has a factory. In addition, TActiveXControl implements the following behaviors:

  • Embedding in a container (site)
  • In-place activation
  • Persistence
  • Events
  • Property pages
  • Property browsing

TActiveXControl is an abstract class, and so cannot be instantiated. Instead, you must derive a new class from TActiveXControl to implement an ActiveX control. This derived class is called an implementation class. An implementation class derived from TActiveXControl normally implements an automation interface as well, to specify the object's properties and methods. 

Ordinarily, you do not create an instance of an implementation class directly. Instead, you create a factory object in the initialization section of the unit that contains the class declaration. The factory object will then create the ActiveX control object when asked to by the system. 

In addition to the interfaces inherited from TAutoObject, TActiveXControl implements the following interfaces:

Note: See the DelCtrls demo in ..\ActiveX\Delctrls for an example of using VCL components as ActiveX controls.


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