GetClipboardData Function

HANDLE GetClipboardData(
  UINT uFormat
);

Retrieves data from the current entry in the clipboard.

Parameters

Return Value

If the function succeeds, the return value is a handle to the clipboard data object in the specified format. The data is in a format that can be directly accessed by the calling process.

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

The handle returned by GetClipboardData is owned by the clipboard. Do not free or modify this handle. To convert the data to another format, you must create a new entry in the clipboard by calling SetClipboardData.

Remarks

To open the clipboard for examination, call the OpenClipboard function. To close the clipboard, call the CloseClipboard function.

If the specified format is not available on the clipboard, GetClipboardData returns NULL.

The system converts the data to the requested format, if possible. If the system cannot convert the data, GetClipboardData returns NULL.

The data is available until the clipboard is next opened by another process, or until the contents of the clipboard are reset.

Note The return value is a handle to a global memory object. The application should not free this memory.

Requirements

Minimum supported client Windows 2000 Professional

Minimum supported server Windows 2000 Server

Header Declared in winuser.h

Library Use User32.lib

DLL User32.dll

See Also