COleControl Class
A powerful base class for developing OLE controls.
class COleControl : public CWnd
Members
Public Constructors
Name |
Description |
---|---|
Creates a COleControl object. |
Public Methods
Name |
Description |
---|---|
Retrieves the current appearance of the control. |
|
Returns the value of the ambient BackColor property. |
|
Returns the name of the control as specified by the container. |
|
Returns the value of the ambient Font property. |
|
Returns the value of the ambient ForeColor property. |
|
Returns the container's locale ID. |
|
Returns the type of units used by the container. |
|
Determines if grab handles should be displayed. |
|
Determines if hatching should be displayed. |
|
Returns the type of text alignment specified by the container. |
|
Determines if the control should respond to user-interface actions. |
|
Determines the mode of the container. |
|
Notifies the container that a bound property has been changed. |
|
Requests permission to edit the property value. |
|
Translates a point relative to the control's origin to a point relative to its container's origin. |
|
Adjusts a caret rectangle if it is overlapped by a control. |
|
Call this function after the set of mnemonics handled by the control has changed. |
|
Displays stock Error events to the control's user. |
|
Implementation of the stock DoClick method. |
|
Serializes the properties of a COleControl object. |
|
Redraws an OLE control that has been subclassed from a Windows control. |
|
Enables simple frame support for a control. |
|
Serializes the control's width and height. |
|
Serializes the control's stock properties. |
|
Serializes the control's version number. |
|
Fires the stock Click event. |
|
Fires the stock DblClick event. |
|
Fires the stock Error event. |
|
Fires a custom event. |
|
Fires the stock KeyDown event. |
|
Fires the stock KeyPress event. |
|
Fires the stock KeyUp event. |
|
Fires the stock MouseDown event. |
|
Fires the stock MouseMove event. |
|
Fires the stock MouseUp event. |
|
Fires an event when the control's ready state changes. |
|
Alters the default activation behavior of a control that supports the IPointerInactive interface. |
|
Returns the value of the specified ambient property. |
|
Returns the value of the stock Appearance property. |
|
Returns the value of the stock BackColor property. |
|
Returns the value of the stock BorderStyle property. |
|
Determines whether a windowless, activated control object has the mouse capture. |
|
Retrieves the OLE class ID of the control. |
|
Retrieves the difference between the upper left corner of the control's rectangular area and the upper left corner of its client area. |
|
Retrieves the size of the control's client area. |
|
Queries an object for the pointer to its current client site within its container. |
|
Retrieves the control flag settings. |
|
Returns the position and size of the OLE control. |
|
Provides a means for a windowless control to get a device context from its container. |
|
Returns the value of the stock Enabled property. |
|
Retrieves a pointer to an extended control object belonging to the container. |
|
Determines whether the control has the focus. |
|
Returns the value of the stock Font property. |
|
Returns the metrics of a CFontHolder object. |
|
Returns the value of the stock ForeColor property. |
|
Returns the value of the stock hWnd property. |
|
Provides status bar text for a menu item. |
|
Prevents access to a control's property value by the user. |
|
Returns the control's readiness state. |
|
Returns the control's rectangle relative to its container. |
|
Returns the metrics of the stock Font property. |
|
Returns the value of the stock Text or Caption property. |
|
Override to allow a windowless control to be the target of drag and drop operations. |
|
Informs the base class of the IIDs the control will use. |
|
Returns a CFontHolder object for the stock Font property. |
|
Retrieves the stock Caption or Text property. |
|
Sets the control's readiness state and fires the ready-state-change event. |
|
Invalidates an area of the displayed control, causing it to be redrawn. |
|
Invalidates the container window's client area within the given region. Can be used to redraw windowless controls in the region. |
|
Allows specialized loading of an OLE control. |
|
Determines if the control state has changed. |
|
Indicates whether the container supports optimized drawing for the current drawing operation. |
|
Called to determine if the control subclasses a Windows control. |
|
Resets any previous asynchronous data and initiates a new load of the control's asynchronous property. |
|
Determines if your control can be deactivated by the container. |
|
Called when an ambient property is changed. |
|
Called when the stock Appearance property is changed. |
|
Called when the stock BackColor property is changed. |
|
Called when the stock BorderStyle property is changed. |
|
Called to fire the stock Click event. |
|
Notifies the control that IOleControl::Close has been called. |
|
Called after a control verb has been executed. |
|
Called when a control is requested to redraw itself. |
|
Called by the container when a control is requested to redraw itself using a metafile device context. |
|
Called by the container to UI Activate an OLE control. |
|
Called when the stock Enabled property is changed. |
|
Called by the container to enumerate a control's verbs. |
|
Called when event handlers are connected or disconnected from a control. |
|
Called when the stock Font property is changed. |
|
Called when the stock ForeColor property is changed. |
|
Called when a control's events are frozen or unfrozen. |
|
Notifies the control that IOleObject::GetColorSet has been called. |
|
Provides mnemonic information to the container. |
|
Called to obtain a string to represent a property value. |
|
Requests the handle of the control's menu that will be merged with the container menu. |
|
Override to retrieve the control's display size closest to the proposed size and extent mode. |
|
Returns strings representing possible values for a property. |
|
Returns the value corresponding to a predefined string. |
|
Override to retrieve the size of the control's display areas (can be used to enable two-pass drawing). |
|
Override to convert control's size into a rectangle starting at a specific position. |
|
Override to retrieve the control's view status. |
|
Called by the container when the control is UI deactivated. |
|
Override to have the container for the inactive control under the mouse pointer dispatch WM_MOUSEMOVE messages to the control. |
|
Override to have the container for the inactive control under the mouse pointer dispatch WM_SETCURSOR messages to the control. |
|
Called after the stock KeyDown event has been fired. |
|
Called after the stock KeyPress event has been fired. |
|
Called after the stock KeyUp event has been fired. |
|
Indicates which property page to use for editing a property. |
|
Called when a mnemonic key of the control has been pressed. |
|
Called when the control's "Properties" verb has been invoked. |
|
Override to query whether a control's display overlaps a given point. |
|
Override to query whether a control's display overlaps any point in a given rectangle. |
|
Called by the framework to retrieve data in the specified format. |
|
Called by the framework to retrieve data from a file in the specified format. |
|
Called by the framework to retrieve data from global memory in the specified format. |
|
Resets a control's properties to the default values. |
|
Notifies the control that IOleControl::SetClientSite has been called. |
|
Replaces the control's data with another value. |
|
Called after the control's extent has changed. |
|
Called after the control's dimensions have been changed. |
|
Called when the control has been UI activated. |
|
Called when the stock Text or Caption property is changed. |
|
Processes window messages (other than mouse and keyboard messages) for windowless controls. |
|
Translates a point relative to the container's origin to a point relative to the control's origin. |
|
Notifies the container that a modal dialog box has been closed. |
|
Notifies the container that a modal dialog box is about to be displayed. |
|
Destroys and re-creates the control's window. |
|
Forces a repaint of a control's appearance. |
|
Releases mouse capture. |
|
Releases the display device context of a container of a windowless control. |
|
Resets the parent of the control window. |
|
Initializes COleControl stock properties to their default values. |
|
Initializes the version number to a given value. |
|
Allows a windowless control to scroll an area within its in-place active image on the display. |
|
Selects a custom Font property into a device context. |
|
Selects the stock Font property into a device context. |
|
Serializes or initializes the display space for the control. |
|
Serializes or initializes the COleControl stock properties. |
|
Serializes or initializes the control's version information. |
|
Sets the value of the stock Appearance property. |
|
Sets the value of the stock BackColor property. |
|
Sets the value of the stock BorderStyle property. |
|
Causes the control's container window to take possession of the mouse capture on the control's behalf. |
|
Sets the position and size of the OLE control. |
|
Sets the value of the stock Enabled property. |
|
Causes the control's container window to take possession of the input focus on the control's behalf. |
|
Sets the value of the stock Font property. |
|
Sets the value of the stock ForeColor property. |
|
Sets the size of an OLE control when first displayed in a container. |
|
Changes the modified state of a control. |
|
Indicates that an edit request has failed. |
|
Prevents modification to a control's property value by the user. |
|
Sets the control's rectangle relative to its container. |
|
Sets the value of the stock Text or Caption property. |
|
Signals that an error has occurred in an OLE control. |
|
Transforms coordinate values between a container and the control. |
|
Converts an OLE_COLOR value to a COLORREF value. |
|
Determines whether ambient properties will be available the next time the control is loaded. |
|
Provides a Windows procedure for a COleControl object. |
Protected Methods
Name |
Description |
---|---|
Called by the framework when the control's appearance needs to be updated. |
|
Called by the framework when the metafile device context is being used. |
|
Enables automation method invocation. |
|
Called by the framework to initialize the list of data formats supported by the control. |
Remarks
Derived from CWnd, this class inherits all the functionality of a Windows window object plus additional functionality specific to OLE, such as event firing and the ability to support methods and properties.
OLE controls can be inserted into OLE container applications and communicate with the container by using a two-way system of event firing and exposing methods and properties to the container. Note that standard OLE containers only support the basic functionality of an OLE control. They are unable to support extended features of an OLE control. Event firing occurs when events are sent to the container as a result of certain actions taking place in the control. In turn, the container communicates with the control by using an exposed set of methods and properties analogous to the member functions and data members of a C++ class. This approach allows the developer to control the appearance of the control and notify the container when certain actions occur.
Windowless Controls
OLE controls can be used in-place active without a window. Windowless controls have significant advantages:
Windowless controls can be transparent and non-rectangular
Windowless controls reduce instance size and creation time of the object
Controls do not need a window. Services that a window offers can easily be provided via a single shared window (usually the container's) and a bit of dispatching code. Having a window is mostly an unnecessary complication on the object.
When windowless activation is used, the container (which does have a window) is responsible for providing services that would otherwise have been provided by the control's own window. For example, if your control needs to query the keyboard focus, query the mouse capture, or obtain a device context, these operations are managed by the container. The COleControl windowless-operation member functions invoke these operations on the container.
When windowless activation is enabled, the container delegates input messages to the control's IOleInPlaceObjectWindowless interface (an extension of IOleInPlaceObject for windowless support). COleControl's implementation of this interface will dispatch these messages through your control's message map, after adjusting the mouse coordinates appropriately. You can process these messages like ordinary window messages, by adding the corresponding entries to the message map.
In a windowless control, you should always use the COleControl member functions instead of the corresponding CWnd member functions or their related Windows API functions.
OLE control objects can also create a window only when they become active, but the amount of work needed for the inactive-active transition goes up and the speed of the transition goes down. There are cases when this is a problem: as an example, consider a grid of text boxes. When cursoring up and down through the column, each control must be in-place activated and then deactivated. The speed of the inactive/active transition will directly affect the scrolling speed.
For more information on developing an OLE control framework, see the articles MFC ActiveX Controls and Overview: Creating an MFC ActiveX Control Program. For information on optimizing OLE controls, including windowless and flicker-free controls, see MFC ActiveX Controls: Optimization.
Inheritance Hierarchy
COleControl
Requirements
Header: afxctl.h