HANDLE GetClipboardData(wFormat)
This function retrieves data from the clipboard in the format given by the wFormat parameter. The clipboard must have been opened previously.
Parameter | Type/Description |
wFormat | WORD Specifies a data format. For a description of the data formats, see the SetClipboardData function, later in this chapter. |
The return value identifies the memory block that contains the data from the clipboard. The handle type depends on the type of data specified by the wFormat parameter. It is NULL if there is an error.
The available formats can be enumerated in advance by using the EnumClipboard-Formats function.
The data handle returned by GetClipboardData is controlled by the clipboard, not by the application. The application should copy the data immediately, instead of relying on the data handle for long-term use. The application should not free the data handle or leave it locked.
Windows supports two formats for text, CF_TEXT and CF_OEMTEXT. CF_TEXT is the default Windows text clipboard format, while Windows uses the CF_OEMTEXT format for text in non-Windows applications. If you call GetClipboardData to retrieve data in one text format and the other text format is the only available text format, Windows automatically converts the text to the requested format before supplying it to your application.
If the clipboard contains data in the CF_PALETTE (logical color palette) format, the application should assume that any other data in the clipboard is realized against that logical palette.