Overview
Group
Quick Info

Windows NT
Yes
Win95
Yes
Win32s
Yes
Import Library
user32.lib
Header File
winuser.h
Unicode
No
Platform Notes
None

GetClipboardData

The GetClipboardData function retrieves data from the clipboard in a specified format. The clipboard must have been opened previously.

HANDLE GetClipboardData(

UINT uFormat
// clipboard format
);

Parameters

uFormat

Specifies a clipboard format. For a description of the clipboard formats, see the SetClipboardData function.

Return Values

If the function succeeds, the return value is the handle of a clipboard object in the specified format.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

An application can enumerate the available formats in advance by using the EnumClipboardFormats function.

The clipboard controls the handle that the GetClipboardData function returns, not the application. The application should copy the data immediately. The application cannot rely on being able to make long-term use of the handle. The application must not free the handle nor leave it locked.

The operating 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. The following table shows the clipboard data type conversions that are available. Note that some of these automatic type conversions are not available on all platforms.

Clipboard Format
Conversion Format
Platform Support
CF_BITMAP
CF_DIB
Windows NT, Windows 95
CF_DIB
CF_BITMAP
Windows NT, Windows 95
CF_DIB
CF_PALETTE
Windows NT, Windows 95
CF_ENHMETAFILE
CF_METAFILEPICT
Windows NT, Windows 95
CF_METAFILEPICT
CF_ENHMETAFILE
Windows NT, Windows 95
CF_OEMTEXT
CF_TEXT
Windows NT, Windows 95
CF_OEMTEXT
CF_UNICODETEXT
Windows NT
CF_TEXT
CF_OEMTEXT
Windows NT, Windows 95
CF_TEXT
CF_UNICODETEXT
Windows NT
CF_UNICODETEXT
CF_OEMTEXT
Windows NT
CF_UNICODETEXT
CF_TEXT
Windows NT

If the operating system provides an automatic type conversion for a particular clipboard format, there is no advantage to placing the conversion format(s) on the clipboard.

If the system provides an automatic type conversion for a particular clipboard format, and you call EnumClipboardFormats to enumerate the clipboard data formats, the operating system first enumerates the format that is on the clipboard, followed by the formats to which it can be converted.

If the clipboard contains data in the CF_PALETTE format, the application should use the SelectPalette and RealizePalette functions to realize any other data in the clipboard against that logical palette.

See SetClipboardData for further information on specific clipboard data formats.

See Also

EnumClipboardFormats
, SetClipboardData, RealizePalette, SelectPalette

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database