OLE Clipboard Formats and ConventionsLast reviewed: February 17, 1995Article ID: Q83659 |
The information in this article applies to:
SUMMARYBecause most OLE server applications can support a number of data formats, the OLE specification defines a data format convention that determines which data format a server application uses to place data on the clipboard. This article explains the Native, OwnerLink, and ObjectLink OLE clipboard data formats.
MORE INFORMATIONAn OLE server application must call the RegisterClipboardFormat function to register the Native, OwnerLink, and ObjectLink OLE data formats. An OLE server application provides the data, which an OLE client application stores. The OLE libraries use the data to reconstruct an object when required.
Contents of OLE FormatsThe Native data format presents the server application's internal data structures. In the process of opening and editing an embedded object, the server application reconstructs the object from native data. The structure of the data is defined only by the server application. The OwnerLink data format describes an embedded object, identifying the class, document name, and name of an object. Each of these data is a null-terminated string. A server application creates OwnerLink data by concatenating the three identifying strings, with a null terminator on each, and appending a final null terminator. The following string is an example of OwnerLink data for a portion of a bitmap saved from Windows Paintbrush:
Paintbrush Picture\0Unused\0(20,10)-(90,100)\0\0In the example above, Paintbrush Picture identifies the class of the object. Because the OwnerLink data format describes an embedded object, the document name field is not used in OLE version 1.0. The application specifies "Unused" as a place holder. The coordinates in the object name field describe the object. Other applications can use a name such as "Figure #1234." The ObjectLink data format describes a linked object. While it contains the same data as the OwnerLink format, the document name and object name fields are much more important. For example, a linked object that originated in Paintbrush might be described with ObjectLink data as in the following:
Paintbrush Picture\0c:\\BITMAP.BMP\0(20,10)-(90,100)\0\0The class name field is the same as the OwnerLink data. In this format, the document name identifies the actual filename of the link, and the object name identifies the portion of the file that makes up the object. Because a linked object is not required to refer to the entire file, the object name must identify the portion of the file that makes up the actual object. Another application may use a different object name, such as a range of cells in a spreadsheet, a slide number in a presentation, or a page number and line number in a document.
Placing OLE Data on the ClipboardWhen the user cuts or copies data to the clipboard, an OLE server application renders the data to the clipboard. The OLE server must render the data in the three OLE formats, as appropriate. If the server can support other data formats, it can also render the data in these formats. The following list presents the data formats. The format that preserves the most information is listed first; subsequent formats lose fidelity.
The CF_BITMAP, CF_DIB, and CF_METAFILEPICT formats provide a static graphic representation of an object. An OLE server application should always provide data in CF_METAFILEPICT format.
|
Additional reference words: 1.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |