GetClipboardData

2.x

  HANDLE GetClipboardData(uFormat)    
  UINT uFormat; /* data format, */  

The GetClipboardData function retrieves a handle of the current clipboard data having a specified format. The clipboard must have been opened previously.

Parameters

uFormat

Specifies the format of the data accessed by this function. For a description of the possible data formats, see the description of the SetClipboardData function.

Return Value

The return value is a handle of the clipboard data in the specified format, if the function is successful. Otherwise, it is NULL.

Comments

The available formats can be enumerated in advance by using the EnumClipboardFormats function.

The data handle returned by the GetClipboardData function 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 (the default Windows text
clipboard format) and CF_OEMTEXT (the format Windows uses 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.

See Also

CloseClipboard, EnumClipboardFormats, IsClipboardFormatAvailable, OpenClipboard, SetClipboardData