IVsObjectList2::EnumClipboardFormats Method (UInt32, UInt32, UInt32, array<VSOBJCLIPFORMAT>^, array<UInt32>^)
Asks the given list item to enumerate its supported clipboard formats.
Assembly: Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)
int EnumClipboardFormats( unsigned int index, unsigned int grfFlags, unsigned int celt, array<VSOBJCLIPFORMAT>^ rgcfFormats, array<unsigned int>^ pcActual )
Parameters
- index
-
Type:
System::UInt32
[in] Specifies the index of the list item of interest.
- grfFlags
-
Type:
System::UInt32
[in] Specifies multi-selection. Values are taken from the _VSOBJCFFLAGS enumeration.
- celt
-
Type:
System::UInt32
[in] Specifies the element count of rgcfFormats.
- rgcfFormats
-
Type:
array<Microsoft.VisualStudio.Shell.Interop::VSOBJCLIPFORMAT>^
[in, out] Specifies an array of VSOBJCLIPFORMAT structures defining the formats supported.
- pcActual
-
Type:
array<System::UInt32>^
[out] Pointer to a count of formats in the rgcfformats array actually returned.
Return Value
Type: System::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
From vsshell80.idl:
[C++]
HRESULT IVsObjectList2::EnumClipboardFormats( [in] ULONG Index, [in] VSOBJCFFLAGS grfFlags, [in] ULONG celt, [in, out, size_is(celt)] VSOBJCLIPFORMAT rgcfFormats[], [out, optional] ULONG *pcActual );
The environment supports three standard clipboard formats: CF_NAVINFO, CF_TEXT, and CF_UNICODETEXT. You may create and register your own clipboard formats. For information on OLE clipboard format implementation and registration, see Clipboard Formats in the MSDN Library Platform SDK documentation set.
The environment calls EnumClipboardFormats to obtain a list of clipboard formats that you support for drag-drop and copy-paste operations. The environment first calls EnumClipboardFormats (index, grfFlags, 0, null, pcActual) to get the count of clipboard formats your list provides. It then allocates an array of size pcActual, and then calls EnumClipboardFormats (index, grfFlags, pcActual, rcgfFormats, pcActual).
Fill the rgcfformats array with VSOBJCLIPFORMAT structures containing the formats you support. Each VSOBJCLIPFORMAT structure identifies the format, the type of medium, and whether the format is a composite one. With composite formats, the environment does the actual rendering after calling GetExtendedClipboardVariant. Otherwise, the list itself does the rendering through GetClipboardFormat. In the case of multiple selections, you would only support composite formats. This enables the environment to write the format in the form: <count of items><xyz variant from selected item1><xyz variant from selected item2>.
Only certain VARIANT types that can be persisted are supported. For more information, see CComVariant::WriteToStream.
In the single selection case, your object list is free to provide both traditional and composite formats and is called respectively on GetClipboardFormat or GetExtendedClipboardVariant for each.
The Class View and Object Browser automatically provide a CF_NAVINFO and a CF_TEXT/CF_UNICODETEXT format, so EnumClipboardFormats should not return these values.