Programmer Reference : Object Linking and Embedding (OLE) : Using OLE custom controls (OCXs)
Using OLE custom controls (OCXs)
An OLE custom control (OCX) is an embedded OLE object that is activated in place. Unlike OLE objects, however, OCXs are manipulated programmatically by their containers through standard OLE automation protocols. OCXs are most often implemented as DLLs, which are directly loaded into the address space of their container.
An OCX:
Has an OLE automation element with properties that are retrieved and modified, and methods that are invoked
Obtains information from its container to initialize its own state; that is, it gathers the ambient properties from its container
Notifies its container, through events, when a user action causes its state to change or a function to be performed.
Essentially, an OCX is an in-place-activated OLE object. On the other hand, an OCX container is a standard OLE container that supports visual editing.
An OCX container:
Provides in its user interface the site for the OCX's user interface.
Note:
Some OCXs may not have a user interface component; it is not a requirement.
Sets properties and makes action requests, through OLE automation, of an OCX
Provides an ambient-properties handler (callback) that responds to ambient-property requests from an OCX
Provides a set of event handlers (callbacks) that respond to event notifications from an OCX.
The steps to create an OLE container that contains OCXs are:
1. As part of the initialization for the user-interface widget hierarchy, create an OleMainWindow.
2. Implement methods to create OleControl widgets and the OCX objects that are to appear within their borders.
3. Implement the ambient-property handler.
4. Use OLE automation aspects of an OCX to set or get properties and invoke methods on the OCX.
5. Implement the event handler callbacks.
Last modified date: 01/29/2015