10.2. OLE Controls

Microsoft Visual C++/Microsoft Foundation Classes


10.2. OLE Controls (previously called OCX's)

10.2.1. What is an OLE control?

OLE controls are the 32-bit successor to 16-bit VBX controls. Instead of being stored in a plain DLL and having functional interfaces, OLE controls rely on OLE automation. Hopefully this will make the interface more flexible and easier to use than VBXs.

Although OLE controls use OLE, they are not object oriented. There is a flat set of properties you have access to and you can not apply OO techniques such as inheritance, polymorphism, etc.. to them. In my opinion, this can be pretty frustrating to the MFC programmer who is used to the OO techniques.

[email protected], 6/25/95

10.2.2. How do I write OLE controls?

In VC++ 2.x, Microsoft released the CDK (OLE control developer kit), you use that kit and it's tools to write OLE controls. In VC++ 4.0, this is no longer separate and you now just run the Control Wizard. Check your VC++ documentation for more info.

[email protected], 6/25/95

10.2.3. What versions of MFC support OLE control containment?

MFC 4.0 supports OLE control containment. Earlier versions of MFC don't unless you roll your own. (yuck!)

10.2.4. How do I get application specific control bars to disappear when in-placed editing.

Add CBRS_HIDE_INPLACE to Create() of the toolbar.

Example:

m_wndFormBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_HIDE_INPLACE, IDW_FORMBAR)

Paul Rony, [email protected]