Programmer's Reference
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:
- As part of the initialization for the user-interface widget hierarchy,
create an OleMainWindow.
- Implement methods to create OleControl widgets and the OCX
objects that are to appear within their borders.
- Implement the ambient-property handler.
- Use OLE automation aspects of an OCX to set or get properties and invoke
methods on the OCX.
- Implement the event handler callbacks.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]