Places a pointer to a specific data object onto the clipboard. This makes the data object accessible to the OleGetClipboard function.
WINOLEAPI OleSetClipboard(
IDataObject * pDataObj //Pointer to the data object being copied
// or cut
);
If you are writing an application that can act as the source of a clipboard operation, you must do the following:
All formats are offered on the clipboard using delayed rendering (the clipboard contains only a pointer to the data object unless a call to OleFlushClipboard renders the data onto the clipboard). The formats necessary for OLE 1 compatibility are synthesized from the OLE 2 formats that are present and are also put on the clipboard.
The OleSetClipboard function assigns ownership of the clipboard to an internal OLE window handle. The reference count of the data object is increased by 1, to enable delayed rendering. The reference count is decreased by a call to the OleFlushClipboard function or by a subsequent call to OleSetClipboard specifying NULL as the parameter value (which clears the clipboard).
When an application opens the clipboard (either directly or indirectly by calling the Win32 OpenClipboard function), the clipboard cannot be used by any other application until it is closed. If the clipboard is currently open by another application, OleSetClipboard fails. The internal OLE window handle satisfies WM_RENDERFORMAT messages by delegating them to the IDataObject implementation on the data object that is on the clipboard.
Specifying NULL as the parameter value for OleSetClipboard empties the current clipboard. If the contents of the clipboard are the result of a previous OleSetClipboard call and the clipboard has been released, the IDataObject pointer that was passed to the previous call is released. The clipboard owner should use this as a signal that the data it previously offered is no longer on the clipboard.
If you need to leave the data on the clipboard after your application is closed, you should call OleFlushClipboard instead of OleSetClipboard.
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in ole2.h.
Import Library: Included as a resource in ole32.dll.
OleFlushClipboard, OleGetClipboard, OleIsCurrentClipboard