# ActiveX Controls

ActiveX controls technology rests on a foundation consisting of COM, connectable objects, compound documents, property pages, OLE automation, object persistence, and system-provided font and picture objects. As summarized below, each of these core technologies plays a role in controls:

COM
  A control is essentially a COM object that exposes the IUnknown interface, through which clients can obtain pointers to its other interfaces. Controls can support licensing through IClassFactory2 and self-registration. See The Component Object Model chapter for more information on COM, licensing, and self-registration.
Connectable objects
  Controls can support outgoing interfaces through connectable objects so that the control can communicate with its client. For example, an outgoing interface can trigger an action in the client, can notify the client of some change in the control, or can request permission from the client before the control takes some action. See the Connectable Objects chapter for more information on how connectable objects work.
Uniform data transfer
  Controls can support being dragged and dropped within a container with help from their container. See IOleInPlaceObjectWindowless::GetDropTarget for more information on drag and drop.
Compound documents
  A control can be an in-place active object that can be embedded in a containing client. An end-user activates the control to initiate an action in the container application. See the Compound Documents chapter for more information on in-place activation and other compound document interfaces.
Property pages
  Controls can provide property pages so end users can view and change the control’s properties. See the Property Pages and Property Sheets chapter for more information on how property pages work.
OLE automation
  Controls can provide programmability through OLE automation so clients can take advantage of the control’s features through a programming language supplied by the client. See the OLE Automation section for more information on OLE automation.
Persistent storage
  A control can implement one or more of several persistence interfaces to support persistence of its state. The control implementer must decide what kinds of persistence are most important and implement the appropriate persistence interfaces. The client decides which interface it prefers to use. See The Component Object Model chapter for more information on all the persistence interfaces.
Font and picture objects
  Controls can use these system provided objects to provide a visual representation of themselves within the client. The font object implements several interfaces, including IFont and IFontDisp. A font object can be created with OleCreateFontIndirect. The picture object also implements several interfaces, including IPicture and IPictureDisp. A picture object can be created using OleCreatePictureIndirect and can loaded from a stream with OleLoadPicture. The standard font and picture objects are described in this chapter.

It is important to understand that these features can be used in any OLE object. One does not need to implement a control in order to use these features. Also, the only required interface on a control is IUnknown. The control optionally supports other interfaces based on the need to support the related features.

In addition to these features, the following interfaces and API functions are specific to controls technology: IOleControl, IOleControlSite, ISimpleFrameSite, the API function OleTranslateColor. Also specific to controls are a set of standards for properties and methods that a control or a control container can support.

See the ActiveX Control and Control Container Guidelines appendix for more information on controls and their containers.

Notes For new systems (NT 4.0 and above), the system library OLEAUT32.DLL contains implementations of the API functions (OleCreatePropertyFrame, OleCreatePropertyFrameIndirect, OleCreateFontIndirect, OleCreatePictureIndirect, OleIconToPicture, OleLoadPicture, and OleTranslateColor).

In addition, OLEAUT32.DLL contains the implementations of the standard font and picture objects, as well as a type library for all the interfaces used with controls as well as the additional data structures and data types.

For older systems, the redistributable library, OLEPRO32.DLL, contains these implementations. Applications or components for older systems that use these API functions can link with the import library, OLEPRO32.LIB.