Summary

OLE makes it possible to work with all clipboard data through the IDataObject interface. The API function OleGetClipboard retrieves a data object that encapsulates the data on the clipboard, regardless of whether that data was placed there by an OLE-aware application or a non-OLE Windows application. An OLE-aware source application copies data to the clipboard by packaging that data inside a data object and passing that object's IDataObject pointer to the API function OleSetClipboard. This makes all global-memory–based data in that object available to all applications (OLE and non-OLE alike) and makes any other data based on other mediums available to OLE-aware consumers. Through the OLE Clipboard, then, applications can achieve higher-performance data exchange without losing compatibility with any other non-OLE applications.

In this chapter, we examine the methods for working with the OLE Clipboard protocol and see how simple OLE code can easily replace other code to manipulate the clipboard through the existing Windows API. Both the Cosmo and Patron samples show all this, and Patron also demonstrates the use of the OLE UI Library's Paste Special dialog box, in which the user can specifically select a data format to paste. This work in Patron enables it to store meaningful information in its documents.