user32.dll
HANDLE GetClipboardData(UINT uFormat);
| Parameter | Description |
|---|---|
uFormat |
The format of the clipboard data to retrieve. This parameter can be one of the standard clipboard format values or a custom format that has been registered by the RegisterClipboardFormat function. Common values include:
|
If the function succeeds, the return value is a handle to the clipboard data in the specified format. If the function fails, the return value is NULL.
To get extended error information, call GetLastError.
Before calling GetClipboardData, you must open the clipboard by calling the OpenClipboard function. When you are finished retrieving data from the clipboard, you must close the clipboard by calling the CloseClipboard function.
The handle returned by GetClipboardData is owned by the system and should not be freed. It is valid only until the contents of the clipboard are changed or the clipboard is closed.
If the clipboard is empty or if the data is not available in the specified format, GetClipboardData returns NULL.
For text formats, the data is null-terminated.
You should not call GetClipboardData in a loop. Call it once for each format you want to retrieve.
GlobalFree on the memory object returned by GetClipboardData if the data is in a format that requires manual freeing (e.g., CF_OWNERDISPLAY). However, for most standard formats, the system manages the memory.
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | winuser.h (include windows.h) |
| Library | User32.lib |
| DLL | User32.dll |