1 out of 8 rated this helpful - Rate this topic

GetClipboardData function

Applies to: desktop apps only

Retrieves data from the clipboard in a specified format. The clipboard must have been opened previously.

Syntax

HANDLE WINAPI GetClipboardData(
  __in  UINT uFormat
);

Parameters

uFormat [in]

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

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 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

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
CloseClipboard
EmptyClipboard
EnumClipboardFormats
SetClipboardData
Conceptual
Clipboard

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
"HANDLE" type
The returned HANDLE is of type HGLOBAL, see GlobalLock() and GlobalUnock() to actually use it.