You are currently offline, waiting for your internet to reconnect

OLE Concepts and Requirements Overview

This article was previously published under Q86008
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
SUMMARY
OLE is a technology that enables an application to create compounddocuments that contain information from a number of different sources. Forexample, a document in an OLE-enabled word processor can accept an embeddedspreadsheet object. Unlike traditional "cut and paste" methods where thereceiving application changes the format of the pasted information,embedded documents retain all their original properties. If the userdecides to edit the embedded data, Windows activates the originatingapplication and loads the embedded document.

This article provides an overview of the OLE libraries; discusses theVTBL (virtual method table) data structure, which is a requiredelement of each OLE application; and discusses using the Windowsclipboard in an OLE application.
MORE INFORMATION

OLECLI.DLL -- The OLE Client Library

OLECLI.DLL, the OLE client library in the Microsoft Windows environment, provides services to simplify anOLE client application. Bidirectional communication takes placebetween a client application and the OLE client library. A clientapplication calls functions in the client library to perform OLE taskssuch as object creation, rendering, loading, and saving. The clientlibrary sends status information to the application by calling anapplication-defined callback function. The status data the librarypasses to the client's callback function includes notification that anobject has been changed, renamed, saved, or closed by an OLE serverapplication.

OLESVR.DLL -- The OLE Server Library

OLESVR.DLL, the OLE server library, provides services for an OLEserver application. Bidirectional communication takes place between aserver application and the OLE server library. A server applicationcalls functions in the server library to register itself as available,or to revoke its availability. It also calls server library functionsto indicate when it saves or renames a document. The server libraryconveys information to the server application through a set of 27application-defined callback functions. Each of the serverapplication's callback functions, which are commonly called methods,is called to request that the server perform a specific action, or toinform it that a specific event has occurred.

Object Handlers

An end-user is typically concerned only with two types of OLEapplications: client applications and server applications. However, anapplication developer must also be aware of a third type of OLE modulecalled an object handler. An object handler is a dynamic-link library(DLL) that can be conceptualized as a limited-function serverapplication. An object handler contains functions required to supporta server application's object classes. For example, when a clientapplication invokes an object's verb, this call can be processed by anobject handler that loads into memory, processes the call, and unloadsfrom memory without any assistance from the main server application.An object handler provides an efficient way to manage objects, becausea handler is typically small and can be loaded and unloaded moreefficiently than an (often large) full-function server application. Anobject handler is implemented using the OLE server library just like afully-functioned server application.

Using VTBLs

As noted above, communication from the OLE client library to a clientapplication, and from the OLE server library to a server application,takes place through application-defined callback functions. During theinitialization of a client or server application, it calls theappropriate library with a pointer to a VTBL data structure. Thelibrary uses the pointers in the VTBL to call the application'scallback functions.

For example, one of the VTBLs that a server application provides tothe OLE server library is called an OLESERVERVTBL. The serverapplication fills the OLESERVERVTBL structure with pointers to sixcallback functions that implement the Create, CreateFromTemplate,Edit, Exit, Open, and Release methods. Once the server applicationpasses the initialized VTBL to the server library, the library cancall any of the six methods just by dereferencing pointers in theVTBL. Note that using a VTBL allows the OLE libraries to call anapplication-defined function that implements a method independent ofthe function's name.

To programmers familiar with the C++ language, the VTBL concept mayseem similar to the C++ virtual method concept. In fact, VTBLs andvirtual methods are closely related. A VTBL allows the OLE librariesto specify the methods that a client or server application mustimplement, while allowing the implementation of each method to bedefined differently for each object class.

Inter-library Communication

In the initial implementation of the OLE libraries, provided withversion 3.1 of the Microsoft Windows Software Development Kit (SDK),the libraries communicate with each other using the dynamic dataexchange (DDE) messaging protocol. The client and server librariessend each other a standard set of OLE commands using WM_DDE_EXECUTEmessages. This implementation of the OLE libraries does not use theDynamic Data Exchange Management Library (DDEML) developed for Windowsversion 3.1 because the DDEML and the OLE libraries were developed inparallel. Future versions of the OLE libraries may use the DDEML oranother interprocess communication mechanism.

The inter-library communication protocol used by the OLE libraries ishidden by the libraries themselves and it should not affect the designof an OLE client or server application.

The Shell Library

Many OLE applications also use a third library, SHELL.DLL. The shelllibrary provides API functions that allow an application to read andmodify the Windows registration database. The registration databasecontains information about the OLE servers installed on the system,and the object classes and verbs that each supports. The shell libraryalso provides support for drag-and-drop manipulation of files usingthe Windows File Manager. If an OLE client implements drag-and-dropsupport, a file may be dragged from the File Manager and dropped on adocument in a client application to embed the file in the document.

Placing an OLE Object on the Clipboard

The presentation format used to display an object specifies theobject's appearance. When a server application places an object on theclipboard, it supplies one or more graphical representations of theobject. These representations can include the metafile(CF_METAFILEPICT) format, the device-dependent bitmap (CF_BITMAP)format, or the device-independent bitmap (CF_DIB) format. When theuser pastes an object into a container document in a clientapplication, the OLE libraries use one of these presentation formatsto display the object. Because a bitmap or a metafile commonly changesappearance when it is resized, the appearance of an object may varydepending on the presentation format used to display the object.

An embedded object is stored on the clipboard in the OwnerLink format,the Native format, and one of the three presentation formats describedabove (CF_METAFILEPICT, CF_BITMAP, or CF_DIB). Each presentation andpredefined Windows format is represented by a named constant in theWINDOWS.H header file included with the SDK. However, the OwnerLinkand Native formats, which are used by every OLE application, are notdefined in WINDOWS.H. Each OLE application must call theRegisterClipboardFormat function to register the OwnerLink and Nativeformats with Windows.
3.00 3.10 1.00
Properties

Article ID: 86008 - Last Review: 10/27/1999 10:55:00 - Revision: 1.0

Microsoft OLE 1.0

  • KB86008
Feedback
html>