Object Linking and Embedding
Encyclopedia
Object Linking and Embedding (OLE) is a technology developed by Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

 that allows embedding and linking to documents and other objects. For developers, it brought OLE Control eXtension (OCX), a way to develop and use custom user interface elements. On a technical level, an OLE object is any object that implements the IOleObject interface, possibly along with a wide range of other interfaces, depending on the object's needs.

Overview

OLE allows an editing application to export part of a document to another editing application and then import it with additional content. For example, a desktop publishing
Desktop publishing
Desktop publishing is the creation of documents using page layout software on a personal computer.The term has been used for publishing at all levels, from small-circulation documents such as local newsletters to books, magazines and newspapers...

 system might send some text to a word processor
Word processor
A word processor is a computer application used for the production of any sort of printable material....

 or a picture to a bitmap editor using OLE. The main benefit of OLE is to add different kinds of data to a document from different applications, like a text editor and an image editor. This creates a compound document
Compound document
In computing, a compound document is a document type typically produced using word processing software, and is a regular text document intermingled with non-text elements such as spreadsheets, pictures, digital videos, digital audio, and other multimedia features...

 and a master file to which the document references. Changes to data in the master file immediately affects the document that references it. This is called "linking" (instead of "embedding").

Its primary use is for managing compound documents, but it is also used for transferring data between different applications
Application software
Application software, also known as an application or an "app", is computer software designed to help the user to perform specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media players. Many application programs deal principally with...

 using drag and drop and clipboard
Clipboard (software)
The clipboard is a software facility that can be used for short-term data storage and/or data transfer between documents or applications, via copy and paste operations...

 operations. The concept of "embedding" is central to the inclusion of multimedia
Multimedia
Multimedia is media and content that uses a combination of different content forms. The term can be used as a noun or as an adjective describing a medium as having multiple content forms. The term is used in contrast to media which use only rudimentary computer display such as text-only, or...

 in Web page
Web page
A web page or webpage is a document or information resource that is suitable for the World Wide Web and can be accessed through a web browser and displayed on a monitor or mobile device. This information is usually in HTML or XHTML format, and may provide navigation to other web pages via hypertext...

s, such as video
Video
Video is the technology of electronically capturing, recording, processing, storing, transmitting, and reconstructing a sequence of still images representing scenes in motion.- History :...

, animation
Animation
Animation is the rapid display of a sequence of images of 2-D or 3-D artwork or model positions in order to create an illusion of movement. The effect is an optical illusion of motion due to the phenomenon of persistence of vision, and can be created and demonstrated in several ways...

 (including Flash animations), and audio
Sound recording and reproduction
Sound recording and reproduction is an electrical or mechanical inscription and re-creation of sound waves, such as spoken voice, singing, instrumental music, or sound effects. The two main classes of sound recording technology are analog recording and digital recording...

 files within the hypertext
Hypertext
Hypertext is text displayed on a computer or other electronic device with references to other text that the reader can immediately access, usually by a mouse click or keypress sequence. Apart from running text, hypertext may contain tables, images and other presentational devices. Hypertext is the...

 markup language
Markup language
A markup language is a modern system for annotating a text in a way that is syntactically distinguishable from that text. The idea and terminology evolved from the "marking up" of manuscripts, i.e. the revision instructions by editors, traditionally written with a blue pencil on authors' manuscripts...

 (such as HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....

 or XHTML
XHTML
XHTML is a family of XML markup languages that mirror or extend versions of the widely-used Hypertext Markup Language , the language in which web pages are written....

) or other structural markup language
Markup language
A markup language is a modern system for annotating a text in a way that is syntactically distinguishable from that text. The idea and terminology evolved from the "marking up" of manuscripts, i.e. the revision instructions by editors, traditionally written with a blue pencil on authors' manuscripts...

 used (such as XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

 or SGML). Modern browsers may use different embedding mechanisms than OLE.

OLE 1.0

OLE 1.0, released in 1990, was the evolution of the original dynamic data exchange
Dynamic Data Exchange
Dynamic Data Exchange is a technology for interprocess communication under Microsoft Windows or OS/2.- Overview :Dynamic Data Exchange was first introduced in 1987 with the release of Windows 2.0 as a method of interprocess communication so that one program can communicate with or control another...

, or DDE, concepts that Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

 developed for earlier versions of Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

. While DDE was limited to transferring limited amounts of data between two running applications, OLE was capable of maintaining active links between two documents or even embedding
Compound document
In computing, a compound document is a document type typically produced using word processing software, and is a regular text document intermingled with non-text elements such as spreadsheets, pictures, digital videos, digital audio, and other multimedia features...

 one type of document within another.

OLE servers and clients communicate with system libraries using virtual function tables, or VTBLs. The VTBL consists of a structure of function pointer
Function pointer
A function pointer is a type of pointer in C, C++, D, and other C-like programming languages, and Fortran 2003. When dereferenced, a function pointer can be used to invoke a function and pass it arguments just like a normal function...

s that the system library can use to communicate with the server or client. The server and client libraries, OLESVR.DLL and OLECLI.DLL, were originally designed to communicate between themselves using the WM_DDE_EXECUTE message.

OLE 1.0 later evolved to become an architecture for software components known as the Component Object Model
Component Object Model
Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

 (COM), and later DCOM
Distributed component object model
Distributed Component Object Model is a proprietary Microsoft technology for communication among software components distributed across networked computers. DCOM, which originally was called "Network OLE", extends Microsoft's COM, and provides the communication substrate under Microsoft's COM+...

.

When an OLE object is placed on the clipboard or embedded in a document, both a visual representation in native Windows formats (such as a bitmap
Bitmap
In computer graphics, a bitmap or pixmap is a type of memory organization or image file format used to store digital images. The term bitmap comes from the computer programming terminology, meaning just a map of bits, a spatially mapped array of bits. Now, along with pixmap, it commonly refers to...

 or metafile
Metafile
Metafile is a generic term for a file format that can store multiple types of data. This commonly includes graphics file formats. These graphics files can contain raster, vector, and type data...

) is stored, as well as the underlying data in its own format. This allows applications to display the object without loading the application used to create the object, while also allowing the object to be edited, if the appropriate application is installed.

The Object Packager, a component of OLE, shipping from Windows 3.1 up to Windows XP
Windows XP
Windows XP is an operating system produced by Microsoft for use on personal computers, including home and business desktops, laptops and media centers. First released to computer manufacturers on August 24, 2001, it is the second most popular version of Windows, based on installed user base...

 allows a non-OLE object to be "packaged" so it can be embedded into an OLE client.

OLE 2.0

OLE 2.0 was the next evolution of OLE, sharing many of the same goals as version 1.0, but was re-implemented on top of the Component Object Model (COM)
Component Object Model
Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

 instead of using VTBLs directly. New features were OLE automation
OLE Automation
In Microsoft Windows applications programming, OLE Automation , is an inter-process communication mechanism based on Component Object Model that was intended for use by scripting languages – originally Visual Basic – but now are used by languages run on Windows...

, drag-and-drop
Drag-and-drop
In computer graphical user interfaces, drag-and-drop is the action of selecting a virtual object by "grabbing" it and dragging it to a different location or onto another virtual object...

, in-place activation and structured storage
Structured storage
COM Structured Storage is a technology developed by Microsoft as part of its Windows operating system for storing hierarchical data within a single file...

. Monikers evolved from OLE 1 object names, and provided an hierarchical object and resource naming system similar to URLs or URIs
Úri
Úriis a village and commune in the comitatus of Pest in Hungary....

, which were independently invented. Windows now has merged the two technologies supporting a URL Moniker type, and a Moniker URL scheme. Today Microsoft's Internet Explorer uses the operating system's URL Monikers internally to download resources. Applications which do so can share IE's cache. However most (if not all) competing browsers have a completely independent implementation of Web protocols, including their own cache, and do not use the Moniker system.

OLE custom controls

OLE custom controls were introduced in 1994 as a replacement for the now deprecated Visual Basic Extension
Visual Basic Extension
In computer programming, a Visual Basic Extension or custom control, was the component model used in Microsoft Visual Basic versions 1.0 to 3.0. It is still supported in the 16-bit version of version 4.0, but was made obsolete by OCXs...

 controls. Instead of upgrading these, the new architecture was based on OLE. In particular, any container that supported OLE 2.0 could already embed OLE custom controls, although these controls cannot react to events unless the container supports this. OLE custom controls are usually shipped in the form of a dynamic link library with the .ocx extension. In 1996 all interfaces for controls (except IUnknown) were made optional to keep the file size of controls down, so they would download faster; these were then called ActiveX Controls.

Technical details

OLE objects and containers are implemented on top of the Component Object Model
Component Object Model
Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

; they are objects that can implement interfaces to export their functionality. Only the IOleObject interface is compulsory, but other interfaces may need to be implemented as well if the functionality exported by those interfaces is required.

To ease understanding of what follows, a bit of terminology has to be explained. The view status of an object is whether the object is transparent, opaque, or opaque with a solid background, and whether it supports drawing with a specified aspect. The site of an object is an object representing the location of the object in its container. A container supports a site object for every object contained.

What follows is a list of interfaces, grouped by the object that usually needs to implement them. Interfaces usually implemented by the OLE object are usually called on by the OLE container, and vice-versa. Note that in the following list indentation indicates interface inheritance. All non-indented interfaces derive from IUnknown
IUnknown
In programming, the IUnknown interface is the fundamental interface in the Component Object Model . The published mandates that COM objects must minimally implement this interface...

.

OLE object

DataObject
When implemented, enables the transfer of data, and notification of data changes. It must be implemented by objects that are to support drag-and-drop, being copied to or pasted from the clipboard, or being linked or embedded in a containing document.

ObjectWithSite
Allows the caller to inform the OLE object of its site. This functionality is also provided by OleObject, but ObjectWithSite can be used, when supported, if OleObject is not used for other matters.

OleCache
Allows visual presentations from a DataObject to be cached. This allows an embedded object to store its visual representation, thus enabling it to be displayed later without needing to start the application that was used to create the object.
Usually the stock implementation is used.
OleCache2
Provides more fine-grained control over caching.
Usually the stock implementation is used.

OleCacheControl
This interface is not called by the container, but internally by the object to allow it to receive notifications of when its DataObject is running, thereby allowing it to subscribe to notifications of data changes of that object and thus allowing it to update the cached presentation properly.
Usually the stock implementation is used.

OleDocument
Allows the OLE object to support multiple views of its data, as well as a few related functions.

OleDocumentView
A document object (an object that implements OleDocument) implements this interface for every view. It allows the caller to set the site of the object, query and set the size of the object and to show and activate it, as well as some related functions.

OleWindow
OleInPlaceActiveObject
Called by the outermost container of an object to interact with it while it's active, e.g. to process accelerator keys in the container's message queue that are meant for the contained object.
OleInPlaceObject
Called by the container to activate or deactivate the object.
IOleInPlaceObjectWindowless
A windowless object is an object that doesn't have its own window but it instead displayed in its container's window. It is used by the container to relay messages received by the container's window that are intended for the contained object. For example, if the mouse is moved over a window, Windows places a mouse move message along with the mouse coordinates in the message queue of the window. If this window contains windowless embedded objects, the message may have to be relayed to such an object if the coordinates of the mouse-pointer are over this object. For similar reasons this interface also provides access to the object's DropTarget interface.

OleLink
Allows the object to support linking, e.g. by allowing the container to set the source of a linked object.
Usually the stock implementation is used.

OleObject
Arguably the most important interface for an OLE object. For example, it allows the container to inform the object of its site, initialize the object from data, to open and close it, to query and set the size of the object, to ask for notifications on the container's AdviseSink and to execute objects defined as "verbs" on the object. These verbs often include "Open" or "Edit", but can also include other verbs. One of the verbs is defined to be the principal verb, and it is executed when the user double-clicks an object.

ViewObject
Allows an object to draw itself directly, without passing a DataObject to the container. For objects that support both DataObject and this interface, the underlying implementation is usually shared.
ViewObject2
Additionally allows the caller to query the size of the object.
ViewObjectEx
Adds support for flicker-free drawing of transparent objects, hit-testing
Hit-testing
In computer graphics programming, hit-testing is the process of determining whether a user-controlled cursor intersects a given shape, line, or curve drawn on the screen...

 for objects with irregular shapes and setting the size of an object.

OLE container

IAdviseSink
Allows the implementer to receive notifications when the object is saved, closed, renamed, or when its data or visual presentation changes.
IAdviseSink2
Additionally allows the implementer to receive notifications when the link source of the OLE object changes.
IAdviseSinkEx
Additionally allows the implementer to receive notifications when the view status of the OLE object changes.

IOleClientSite
This interface allows the caller to obtain information on the container and location of an object, as well requesting that the object be saved, resized, shown, hidden, et cetera.

IOleDocumentSite
Allows the caller to ask for the object on this site to be activated immediately. If this interface is implemented, IOleClientSite, IOleInPlaceSite and IAdviseSink must be implemented as well.

IOleContainer
This interface allows the caller to enumerate embedded objects in a container, or to find such objects by name. It is primarily useful if the container wishes to support links to embedded objects.

IOleWindow
IOleInPlaceUIWindow
Enables embedded objects to negotiate space for toolbars on the container's window.
IOleInPlaceFrame
Allows the caller to ask the container to insert its menu items in an empty menu that will become the cooperative menu. Also allows the caller to ask the container to show or hide this menu, to show or hide dialog boxes, and to process accelerator keys received by the contained object intended for the container.
IOleInPlaceSite
If a container implements this interface, it allows embedded objects to be activated in place, i.e. without opening in a separate window. It provides access to the container's IOleInPlaceUIWindow.
IOleInPlaceSiteEx
If a container implements this interface, it allows embedded objects to check whether they need to redraw on activation or deactivation. It also allows them to request their UI to activate.
IOleInPlaceSiteWindowless
If a container wishes to support windowless embedded objects, it needs to provide functionality to embedded objects to replace the functionality normally provided by an embedded object's window. For example this interface provides a way to access the container's window's device context, thereby enabling the embedded object to draw in the container's window.

IOleUILinkContainer
Contains the methods that the standard OLE dialog boxes that manage linked objects use to update linked objects in a container, or to query and change their sources. Used by the "Links", "Change source", "Update links" and "Object properties" dialog boxes.
IOleUILinkInfo
Additionally allows the dialog boxes to query when linked objects were last updated, and whether this was done automatically or manually.
IOleUIObjInfo
Contains the methods needed by the "Object properties" dialog box. For example if the user opens the "Object properties" dialog box and asks for the object to be converted to another type, a method on this interface is called.

IOleUndoManager
Provides a centralized undo service to both the container itself and to embedded objects. When an undoable action is performed, an IOleUndoUnit is created and added to the IOleUndoManager.

Other

IDataAdviseHolder
The methods of IDataObject that pertain to data change notifications can be implemented by calling the methods of this interface.
Usually the stock implementation is used.

IOleAdviseHolder
The methods of IOleObject that pertain to notifcations can be implemented by calling the methods of this interface.
Usually the stock implementation is used.

IDropSource
Implemented by objects that can be dragged, i.e. that can be the source of a drag-and-drop operations. When implemented it allows the object to draw drag-and-drop effects, and to specify when the object is dropped, or the drag-and-drop operation is cancelled.

IDropTarget
Implemented by objects that accept dropped objects, i.e. that can be the target of drag-and-drop operations. When implemented it allows the target to specify if a dropped object will be accepted, and what happens to an object after it is dropped.

IOleCommandTarget
Can be implemented by objects (OLE objects, OLE containers, and other objects) that wish to support certain standard commands. It allows callers to query if commands are supported, and to execute commands. Commands that an object might typically wish to implement may include things like "delete", "cut", "copy", "paste", "undo", "find", "print", "save", "zoom", and so on. Currently 58 standard commands have been defined, and they include commands commonly used by office software, web browsers and similar applications.

IOleUndoUnit
Represents an action that can be undone. It contains all information necessary to undo an action. It is created by objects and containers, so that undoable actions can be added to the container's IOleUndoManager.
IOleParentUndoUnit
Allows an undo unit to contain other undo units. In essence this allows the undo unit to act as an undo stack, grouping undo units together. For example, if a macro is run, all undo-able actions performed by the macro may be grouped together in one undo unit.

IOleWindow
This interface represents a window of a container or contained object. It allows callers to obtain the handle of the window, and to toggle the context-sensitive help function. When the context-sensitive help function is turned on, typically the mouse-pointer changes to an arrow with a question mark to indicate that clicking a user interface element will result in opening a help window.

Criticism

There was a technology, called OpenDoc
OpenDoc
OpenDoc was a multi-platform software componentry framework standard for compound documents, intended as an alternative to Microsoft's Object Linking and Embedding ....

, which tried to compete with OLE. It was considered by interested companies (competitors of Microsoft) to be both easier to use and more robust than OLE. However, OpenDoc does have some known problems. OpenDoc allowed users to view and edit information across applications, directly in competition with Microsoft's proprietary OLE standard. This "features" came at a cost. A consortium called the Component Integration Laboratories ("CIL") was established in 1993 by some Microsoft competitors to create OpenDoc as an "open-source" standard for cross-platform linking and embedding.

Microsoft unilaterally announced that its OLE proprietary technology would be incorporated directly into MS Windows operating system. Microsoft then required OLE compatibility as a condition of Microsoft's certification of an application's compatibility with Windows 95
Windows 95
Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Windows products...

.

Microsoft initially announced that applications using OpenDoc would be deemed compatible with OLE, and would receive certification for Windows 95. Microsoft later announced that applications using OpenDoc would not receive automatic certification, and might not receive certification at all. Microsoft withheld specifications and debugged versions of OLE until after it had released its competing applications.

Interoperability

Use of Microsoft Object Linking and Embedding (OLE) objects limits the interoperability, because these objects are not widely supported in programs for viewing or editing files (e.g. embedding of other files inside the file, such as tables or charts from a spreadsheet application in a text document or presentation file). If software that understands an OLE object is not available, the object is usually replaced by a picture (bitmap representation of the object) or not displayed at all.

See also

  • OLE Automation
    OLE Automation
    In Microsoft Windows applications programming, OLE Automation , is an inter-process communication mechanism based on Component Object Model that was intended for use by scripting languages – originally Visual Basic – but now are used by languages run on Windows...

  • OLE for process control
    OLE for process control
    OLE for Process Control , which stands for Object Linking and Embedding for Process Control, is the original name for a standards specification developed in 1996 by an industrial automation industry task force...

  • Component Object Model
    Component Object Model
    Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

     (COM)
  • Distributed Component Object Model
    Distributed component object model
    Distributed Component Object Model is a proprietary Microsoft technology for communication among software components distributed across networked computers. DCOM, which originally was called "Network OLE", extends Microsoft's COM, and provides the communication substrate under Microsoft's COM+...

     (DCOM)
  • Dynamic Data Exchange
    Dynamic Data Exchange
    Dynamic Data Exchange is a technology for interprocess communication under Microsoft Windows or OS/2.- Overview :Dynamic Data Exchange was first introduced in 1987 with the release of Windows 2.0 as a method of interprocess communication so that one program can communicate with or control another...

     (DDE)
  • Internet media type
    Internet media type
    An Internet media type, originally called a MIME type after MIME and sometimes a Content-type after the name of a header in several protocols whose value is such a type, is a two-part identifier for file formats on the Internet.The identifiers were originally defined in RFC 2046 for use in email...


  • Multipurpose Internet Mail Extensions (MIME)
  • Shscrap.dll (shell scrap files)

External links

  • ripOLE - extracts attachments from OLE documents
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK