Export (0) Print
Expand All

GetClipboardData function

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

Caution  Clipboard data is not trusted. Parse the data carefully before using it in your application.

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 [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
CloseClipboard
EmptyClipboard
EnumClipboardFormats
SetClipboardData
Conceptual
Clipboard

 

 

Community Additions

ADD
Show:
© 2014 Microsoft