Carries out the clipboard shutdown sequence. It also releases the instance of the IDataObject interface that was placed on the clipboard by the OleSetClipboard function.

HRESULT OleFlushClipboard();

Return Values


Indicates the clipboard has been flushed.


Indicates the Windows OpenClipboard function used within OleFlushClipboard failed.


Indicates the Windows CloseClipboard function used within OleFlushClipboard failed.


If you are writing an application that can act as the source of a clipboard operation, you can call OleFlushClipboard to flush the clipboard and release the instance of IDataObject when your application is closed (e.g., if the user exits from your application). A call to the OleSetClipboard function using NULL will empty the clipboard.

The difference is that OleFlushClipboard leaves all formats offered by the data transfer object, including the OLE 1 compatibility formats, on the clipboard so they are available after application shutdown. In addition to OLE 1 compatibility formats, these include all formats offered on a global handle medium (all except for TYMED_FILE) and formatted with a NULL target device.

When your application closes, you should call OleSetClipboard using NULL if there is no need to leave data on the clipboard after shutdown or if data will be placed on the clipboard using the standard Windows clipboard functions. Applications should call OleFlushClipboard to enable pasting and paste-linking of OLE objects after shutdown.

Before calling OleFlushClipboard, it must be convenient to check the clipboard. You can call the OleIsCurrentClipboard function to determine if your data is still on the clipboard.

See Also

OleSetClipboard, OleIsCurrentClipboard, IDataObject,

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