Rediger

Del via


Clipboard

The clipboard is a set of functions and messages that enable applications to transfer data. Because all applications have access to the clipboard, data can be easily transferred between applications or within an application.

This overview does not describe how to copy and paste linked or embedded objects. For information on these subjects, see the Component Object Model (COM) documentation.

In This Section

Name Description
About the Clipboard
Discusses the clipboard.
Clipboard Formats
Discusses the clipboard formats. A window can place more than one object on the clipboard, each representing the same information in a different clipboard format. Users need not be aware of the clipboard formats used for an object on the clipboard.
Clipboard Operations
Discusses clipboard operations. A window should use the clipboard when cutting, copying, or pasting data. A window places data on the clipboard for cut and copy operations and retrieves data from the clipboard for paste operations.
HTML Clipboard Format
Discusses the HTML Clipboard format.
Using the Clipboard
A clipboard viewer window displays the current content of the clipboard, and receives messages when the clipboard content changes.
Clipboard Reference
Contains the API reference.

Clipboard Functions

Name Description
AddClipboardFormatListener
Places the given window in the system-maintained clipboard format listener list.
ChangeClipboardChain
Removes a specified window from the chain of clipboard viewers.
CloseClipboard
Closes the clipboard.
CountClipboardFormats
Retrieves the number of different data formats currently on the clipboard.
EmptyClipboard
Empties the clipboard and frees handles to data in the clipboard. The function then assigns ownership of the clipboard to the window that currently has the clipboard open.
EnumClipboardFormats
Enumerates the data formats currently available on the clipboard.
Clipboard data formats are stored in an ordered list. To perform an enumeration of clipboard data formats, you make a series of calls to the EnumClipboardFormats function. For each call, the format parameter specifies an available clipboard format, and the function returns the next available clipboard format.
GetClipboardData
Retrieves data from the clipboard in a specified format. The clipboard must have been opened previously.
GetClipboardFormatName
Retrieves from the clipboard the name of the specified registered format. The function copies the name to the specified buffer.
GetClipboardOwner
Retrieves the window handle of the current owner of the clipboard.
GetClipboardSequenceNumber
Retrieves the clipboard sequence number for the current window station.
GetClipboardViewer
Retrieves the handle to the first window in the clipboard viewer chain.
GetOpenClipboardWindow
Retrieves the handle to the window that currently has the clipboard open.
GetPriorityClipboardFormat
Retrieves the first available clipboard format in the specified list.
GetUpdatedClipboardFormats
Retrieves the currently supported Clipboard formats.
IsClipboardFormatAvailable
Determines whether the clipboard contains data in the specified format.
OpenClipboard
Opens the clipboard for examination and prevents other applications from modifying the clipboard content.
RegisterClipboardFormat
Registers a new clipboard format. This format can then be used as a valid clipboard format.
RemoveClipboardFormatListener
Removes the given window from the system-maintained clipboard format listener list.
SetClipboardData
Places data on the clipboard in a specified clipboard format. The window must be the current clipboard owner, and the application must have called the OpenClipboard function. (When responding to the WM_RENDERFORMAT message, the clipboard owner must not call OpenClipboard before calling SetClipboardData.)
SetClipboardViewer
Adds the specified window to the chain of clipboard viewers. Clipboard viewer windows receive a WM_DRAWCLIPBOARD message whenever the content of the clipboard changes.

Clipboard Messages

Name Description
WM_CLEAR
Sent to an edit control or combo box to delete (clear) the current selection, if any, from the edit control.
WM_COPY
Sent to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format.
WM_CUT
Sent to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format.
WM_PASTE
Sent to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format.

Clipboard Notifications

Name Description
WM_ASKCBFORMATNAME
Sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.
WM_CHANGECBCHAIN
Sent to the first window in the clipboard viewer chain when a window is being removed from the chain.
WM_CLIPBOARDUPDATE
Sent when the contents of the clipboard have changed.
WM_DESTROYCLIPBOARD
Sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard.
WM_DRAWCLIPBOARD
Sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard.
WM_HSCROLLCLIPBOARD
Sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values.
WM_PAINTCLIPBOARD
Sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting.
WM_RENDERALLFORMATS
Sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function.
WM_RENDERFORMAT
Sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function.
WM_SIZECLIPBOARD
Sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size.
WM_VSCROLLCLIPBOARD
Sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values.

Structures

Name Description
METAFILEPICT
Defines the metafile picture format used for exchanging metafile data through the clipboard.