GetClipboardData function (winuser.h)
Retrieves data from the clipboard in a specified format. The clipboard must have been opened previously.
Syntax
HANDLE GetClipboardData(
[in] UINT uFormat
);
Parameters
[in] uFormat
Type: UINT
A clipboard format. For a description of the standard clipboard formats, see Standard Clipboard Formats.
Return value
Type: HANDLE
If the function succeeds, the return value is the handle to a clipboard object in the specified format.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
The clipboard controls the handle that the GetClipboardData function returns, not the application. The application should copy the data immediately. The application must not free the handle nor leave it locked. The application must not use the handle after the EmptyClipboard or CloseClipboard function is called, or after the SetClipboardData function is called with the same clipboard format.
The system performs implicit data format conversions between certain clipboard formats when an application calls the GetClipboardData function. For example, if the CF_OEMTEXT format is on the clipboard, a window can retrieve data in the CF_TEXT format. The format on the clipboard is converted to the requested format on demand. For more information, see Synthesized Clipboard Formats.
Examples
For an example, see Copying Information to the Clipboard.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |
API set | ext-ms-win-ntuser-misc-l1-2-0 (introduced in Windows 8.1) |
See also
Conceptual
Reference