Lesson 3: Object Linking and Embedding

Compound Files

OLE compound document technology rests on a foundation consisting of COM, structured storage, and uniform data transfer. A compound document object is essentially a COM object that can be embedded in, or linked to, an existing document. As a COM object, a compound document object exposes the IUnknown  interface, through which clients obtain pointers to its other interfaces that provide special features unique to compound document objects.

These interfaces include:

  • IoleObject
  • IoleLink
  • IViewObject2

When a compound document is created, one application is a container and the other is a server. The server document can either be linked or embedded into the container application. When a document is linked, it is stored in a separate file from the container. However, embedded documents are stored in the same file as the container.

click to view at full size.

Figure 5.8 Using compound documents

Why Use Compound Files?

Use of compound files is encouraged because the OLE storage system provides efficient and flexible access to object data. The storage system allows objects, or portions of objects, to be read from disk to memory without loading the entire file. This is significant when loading an OLE document that contains either a large number of objects or a single large object such as a video clip, because it is more efficient to load only the data that currently is needed. That is, applications do not have to wait for unwanted data to be loaded before the requested data is made available to the user .

Multiple Formats and Sources

OLE compound documents enable users working within a single application to manipulate data written in various formats and derived from multiple sources. For example, a user might insert a graph created in a second application and a sound object created in a third application into a word processing document. Activating the graph causes the second application to load its user interface, or at least the part containing tools needed to edit the object. Activating the sound object causes the third application to play it. In both cases, a user is able to manipulate data from external sources from within the context of a single document.

* To Use Compound Documents

In this exercise, you will insert a bitmap image into a Microsoft Word document and edit it using Microsoft Paint.

  1. Start Microsoft Word and open a new blank document.
  2. From the Insert menu, click Object .
  3. Select Bitmap Image from the Create New Object dialog and click OK .

    Notice that the menu and toolbars from the Microsoft Paint application are now available in Microsoft Word.

  4. Design a graphic using the Microsoft Paint tools.
  5. Press ESCAPE to return to Word.
  6. Press ESCAPE a second time and add some text to the document.
  7. Double-click the embedded image to resume editing the image using Microsoft Paint.
  8. Exit Microsoft Word, do not save changes.


Microsoft Windows Architecture Training
Microsoft Windows Architecture for Developers Training Kit
ISBN: B00007FY9D
EAN: N/A
Year: 1998
Pages: 324

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net