Düzenle

Aracılığıyla paylaş


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 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 Events in COM and Connectable Objects 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 Compound Documents 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 Property Pages and Property Sheets 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 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.

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 functions are specific to controls technology: IOleControl, IOleControlSite, ISimpleFrameSite, and OleTranslateColor. Also specific to controls are a set of standards for properties and methods that a control or a control container can support.

Note

The system library OleAut32.dll contains implementations of the functions (OleCreatePropertyFrame, OleCreatePropertyFrameIndirect, OleCreateFontIndirect, OleCreatePictureIndirect, 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 more information, see the following topics:

ActiveX Control and Control Container Guidelines