리눅스맨

Standard Clipboard Formats

Standard Clipboard Formats

Shell clipboard Formats

Drag & Drop Related Formats

OLE Formats

 

Common Text Formats

Common Image Formats

 

참조: https://www.codeproject.com/Reference/1091137/Windows-Clipboard-Formats

[원문]

Introduction

This reference gives you an overview of standard and common clipboard formats with links to the data structures.

Definitions

The following type definitions are used in the below tables:

ANSI text
Null terminated ANSI or multi byte string.
Unicode text
Null terminated Unicode (UTF-16LE) string.
ANSI / Unicode text list
List of null terminated strings followed by a NULL character (double NULL terminated).
ASCII / ANSI text
ASCII 7-bit text by definition but ANSI 8-bit text may be supported.
DWORD (BOOL)
DWORD value representing a boolean value (true if not zero).

Links indicate the destination in brackets. For MSDN links in the tables the indication is omitted.

Standard Clipboard Formats

The Standard Clipboard Formats [MSDN] use numeric IDs defined in WinUser.h. All non-standard formats must be registered using a unique format name.

Format Identifier Data Type Description
CF_TEXT (1) ANSI text Text.
CF_BITMAP (2) HBITMAP Handle to a bitmap (GDI object).
CF_METAFILEPICT (3) METAFILEPICT Windows-Format Metafiles picture.
CF_SYLK (4) ANSI text Microsoft Symbolic Link [Wikipedia].
CF_DIF (5) ASCII text Software Arts Data Interchange Format [Wikipedia].
CF_TIFF (6) TIFF [Wikipedia] TIFF image.
CF_OEMTEXT (7) 8-Bit DOS text Text.
CF_DIB (8) BITMAPINFO Structure followed by bitmap bits.
CF_PALETTE (9) HPALETTE Handle to a color palette (GDI object).
CF_PENDATA (10) Windows 3.1 pen extension data.
CF_RIFF (11) RIFF Resource Interchange File Format (RIFF) audio.
CF_WAVE (12) WAVE WAVE audio.
CF_UNICODETEXT (13) Unicode text Text.
CF_ENHMETAFILE (14) HENHMETAFILE Enhanced-Format Metafiles handle.
CF_HDROP (15) DROPFILES List of file names.
CF_LOCALE (16) DWORD (LCID) LCID for CF_TEXT to CF_UNICODE conversion.
CF_DIBV5 (17) BITMAPV5HEADER Structure followed by bitmap bits
CF_DSPTEXT (0x0081) ANSI text Text.
CF_DSPBITMAP (0x0082) HBITMAP Handle to a bitmap (GDI object)
CF_DSPMETAFILEPICT (0x0083) METAFILEPICT Windows-Format Metafiles picture.
CF_DSPENHMETAFILE (0x008E) HENHMETAFILE Enhanced-Format Metafiles handle.

Shell Clipboard Formats

The Shell Clipboard Formats [MSDN] are used to transfer shell objects via clipboard and Drag & Drop. For most of them there is a definition for the format name in the header file shlobj.h:

Definition Format Name
CFSTR_SHELLIDLIST Shell IDList Array
CFSTR_SHELLIDLISTOFFSET Shell Object Offsets
CFSTR_NETRESOURCES Net Resource
CFSTR_FILEDESCRIPTORA FileGroupDescriptor
CFSTR_FILEDESCRIPTORW FileGroupDescriptorW
CFSTR_FILECONTENTS FileContents
CFSTR_FILENAMEA FileName
CFSTR_FILENAMEW FileNameW
CFSTR_PRINTERGROUP PrinterFriendlyName
CFSTR_FILENAMEMAPA FileNameMap
CFSTR_FILENAMEMAPW FileNameMapW
CFSTR_SHELLURL UniformResourceLocator
CFSTR_INETURLA UniformResourceLocator
CFSTR_INETURLW UniformResourceLocatorW
CFSTR_PREFERREDDROPEFFECT Preferred DropEffect
CFSTR_PERFORMEDDROPEFFECT Performed DropEffect
CFSTR_PASTESUCCEEDED Paste Succeeded
CFSTR_INDRAGLOOP InShellDragLoop
CFSTR_DRAGCONTEXT DragContext
CFSTR_MOUNTEDVOLUME MountedVolume
CFSTR_PERSISTEDDATAOBJECT PersistedDataObject
CFSTR_TARGETCLSID TargetCLSID
CFSTR_LOGICALPERFORMEDDROPEFFECT Logical Performed DropEffect
CFSTR_AUTOPLAY_SHELLIDLISTS Autoplay Enumerated IDList Array
CFSTR_UNTRUSTEDDRAGDROP UntrustedDragDrop
CFSTR_FILE_ATTRIBUTES_ARRAY File Attributes Array
CFSTR_INVOKECOMMAND_DROPPARAM InvokeCommand DropParam
CFSTR_SHELLDROPHANDLER DropHandlerCLSID
CFSTR_DROPDESCRIPTION DropDescription

 

Format Name Data Type Description
AsyncFlag DWORD (BOOL) Perform insert/paste operation in the background. Used by Explorer to avoid blocking the current instance.
FileContents Binary File content.
FileGroupDescriptor FILEGROUPDESCRIPTOR Array of FILEDESCRIPTORs.
FileGroupDescriptorW FILEGROUPDESCRIPTOR Array of FILEDESCRIPTORs.
FileName ANSI text Single file name in short (8.3) format.
FileNameW Unicode text Single file name.
FileNameMap ANSI text list List of file names when renaming.
FileNameMapW Unicode text list List of file names when renaming.
MountedVolume Unicode text Path for mounted volume.
Shell IDList Array CIDA Array of PIDL (pointer to ITEMIDLIST) offsets.
Autoplay Enumerated IDList Array CIDA Array of PIDL (pointer to ITEMIDLIST) offsets.
Shell Object Offsets POINT[] Array of points.
File Attributes Array FILE_ATTRIBUTES_ARRAY Array of file attributes.
Net Resource NRESARRAY Array of NETRESOURCE structures.
PrinterFriendlyName DROPFILES List of printer names.
UniformResourceLocator ANSI text URL
UniformResourceLocatorW Unicode text URL

Drag & Drop Related Formats

These formats are used with Drag & Drop. Most of them are not documented.

Format Name Data Type Description
ComputedImage DWORD ?
DisableDragText DWORD (BOOL) ?
DragContext IStream Used internally by the Windows drag/drop helpers.
DragImageBits SHDRAGIMAGE Drag image bitmap.
DragSourceHelperFlags DWORD Value passed to IDragSourceHelper2::SetFlags.
DragWindow DWORD (HWND) The window handle of the drag image window.
DropDescription DROPDESCRIPTION Aero drag cursor type and text.
DropHandlerCLSID CLSID GUID CLSID GUID of the drop handler.
InShellDragLoop DWORD (BOOL) Nonzero when within a drag-and-drop loop.
InvokeCommand DropParam Unicode text ?
IsComputingImage DWORD (BOOL) ?
IsShowingLayered DWORD (BOOL) Nonzero when a drop target shows the drag image.
IsShowingText DWORD (BOOL) Nonzero when a drop target requests update of Aero cursor.
Logical Performed DropEffect DWORD (DROPEFFECT) Logically performed drop effect with optimized moves.
Paste Succeeded DWORD (DROPEFFECT) Set by target when delete-on-paste operation succeeded.
Performed DropEffect DWORD (DROPEFFECT) Performed drop effect set by the target.
Preferred DropEffect DWORD (DROPEFFECT) Preferred drop effect set by source. Used also with clipboard.
TargetCLSID CLSID GUID CLSID GUID of the drop target.
UntrustedDragDrop DWORD URL Action Flags.
UsingDefaultDragImage DWORD (BOOL) Nonzero when the drag image is a system default image.

OLE Formats

Format Name Data Type Description
Link ANSI text list OLE 1.0 link.
Native Binary OLE 1.0 data.
ObjectLink ANSI text list OLE 1.0 link.
OwnerLink ANSI text list OLE 1.0 link.
Data Object Binary OLE 2.0 data.
Embedded Object Binary OLE 2.0 data.
Object Descriptor OBJECTDESCRIPTOR OLE 2.0 User interface information.
Link Source Descriptor OBJECTDESCRIPTOR OLE 2.0 User interface information.
Link Source IMoniker OLE 2.0. Followed by document class ID.
Hyperlink IHlink Methods to enable a hyperlink to navigate to its target.

Common Application Clipboard Formats

Many applications use the file extension or the MIME type [Wikipedia] as format name and pass data using the corresponding file format. The format names are case-insensitive but is is common practice to use all lower case for MIME types, all upper case for file extensions and Pascal case (upper case for first letter of each word) for descriptive names. Clipboard and drop target applications that should be able to receive such formats should register all commonly used format name variations.

The header file UrlMon.h contains some definitions for MIME types (see URL Moniker Clipboard Formats [MSDN]).

Common Text Formats

Format Name Data Type Description
text/plain ASCII / ANSI text See also CF_TEXT.
HTML Format UTF-8 text Microsoft specific HTML clipboard format.
text/html Text HTML [W3C] file content. The encoding is defined by BOM and HTML headers.
HTML (Hyper Text Markup Language) Text See text/html.
text/csv ASCII / ANSI text Comma-Separated Values (CSV) [IETF] file content.
CSV ASCII / ANSI text See text/csv.
text/richtext ASCII / ANSI text Word 2007: Rich Text Format (RTF) Specification, version 1.9.1 [Microsoft]
Rich Text Format ASCII / ANSI text See above.
Rich Text Format Without Objects ASCII / ANSI text See above.
RichEdit Text and Objects ASCII / ANSI text See above.
RTF As Text ASCII / ANSI text See above.
text/uri-list ASCII text The text/uri-list Internet Media Type [IETF].

Common Image Formats

Format Name Data Type Description
image/bmp BITMAPFILEHEADER File header followed by info header (see CF_DIB and CF_DIBV5) and bitmap data.
BMP BITMAPFILEHEADER See image/bmp.
image/gif Binary GIF [W3C] file content.
GIF Binary See image/gif.
image/jpeg Binary JPEG [W3C] file content.
JPEG Binary See image/jpeg.
JPG Binary See image/jpeg.
image/png Binary PNG [W3C] file content.
PNG Binary See image/png.
image/tiff Binary TIFF [Wikipedia] file content. See also CF_TIFF.

Points of Interest

My article Drag & Drop Images and Drop Descriptions for MFC Applications contains a demo application that can be used to show the objects actually on the clipboard (clipboard viewer) and the drag objects when dropping on an info list.

References

Clipboard Formats [MSDN]
Standard Clipboard Formats [MSDN]
Shell Clipboard Formats [MSDN]
Shell Data Object [MSDN]
Handling Shell Data Transfer Scenarios [MSDN]
HTML Clipboard Format [MSDN]
RegisterClipboardFormat function [MSDN]
OLE Background [MSDN]
Clipboard API and events [W3C]

History

2016-04-08 Initial version.
2016-04-14 Minor text changings, added links to GUID and URL moniker formats.
2016-04-18 Splitted and re-arranged tables, added some OLE formats, added text/richtext, corrected enhanced meta file type.
2016-06-21 Added formats text/uri-list, image/bmp, BMP; added link to W3C clipboard API
2017-06-22 Added AsyncFlag format and that Preferred DropEffect also used with clipboard.
2018-03-08 Fixed wrong FileContents description.


게시됨

카테고리

작성자

태그: