Object-Oriented Programming for Windows 95 and NT

The Windows clipboard is a means of transferring data between applications. The clipboard is based on the common data formats and operating environments of all Windows applications and uses this built-in uniformity to provide programmers with a standard method for allowing users to transfer data. This chapter shows that access to the clipboard can be incorporated in an application with very little effort.
The clipboard is an area of memory used for the temporary storage of data. There is only one clipboard for any Windows session but it is available to all applications that have implemented clipboard routines. The clipboard can hold different types of data: text (either standard text or DDE link data) and graphics (bitmaps, device-independent bitmaps, metafiles, or color palettes). When data is stored in the clipboard, the format must be specified. Each clipboard format is identified by a number, which is represented by a standard symbolic constant, as follows:
| Format | Number | Constant |
|---|---|---|
| Text | 1 | CF_TEXT |
| Bitmap file (.BMP) | 2 | CF_BITMAP |
| Metafile (.WMF) | 3 | CF_METAFILE |
| Device-independent bitmap (.DIB) | 8 | CF_DIB |
| Color palette | 9 | CF_PALETTE |
| DDE information | &HBF00 | CF_LINK |
These are the standards that you are most likely to encounter but Windows does recognize other predefined formats. You can also use the RegisterClipboardFormat function to create new formats.
The clipboard can hold only one item of data at a time for any format but there may be data from more than one format. For example, the clipboard can hold a paragraph of text and...