Partilhar via


IVsObjectList2.EnumClipboardFormats Method

Definition

Asks the given list item to enumerate its supported clipboard formats.

int EnumClipboardFormats(unsigned int index, unsigned int grfFlags, unsigned int celt, std::Array <Microsoft::VisualStudio::Shell::Interop::VSOBJCLIPFORMAT> const & rgcfFormats, std::Array <unsigned int> const & pcActual);
public int EnumClipboardFormats (uint index, uint grfFlags, uint celt, Microsoft.VisualStudio.Shell.Interop.VSOBJCLIPFORMAT[] rgcfFormats, uint[] pcActual);
abstract member EnumClipboardFormats : uint32 * uint32 * uint32 * Microsoft.VisualStudio.Shell.Interop.VSOBJCLIPFORMAT[] * uint32[] -> int
Public Function EnumClipboardFormats (index As UInteger, grfFlags As UInteger, celt As UInteger, rgcfFormats As VSOBJCLIPFORMAT(), Optional pcActual As UInteger()) As Integer

Parameters

index
UInt32

[in] Specifies the index of the list item of interest.

grfFlags
UInt32

[in] Specifies multi-selection. Values are taken from the _VSOBJCFFLAGS enumeration.

celt
UInt32

[in] Specifies the element count of rgcfFormats.

rgcfFormats
VSOBJCLIPFORMAT[]

[in, out] Specifies an array of VSOBJCLIPFORMAT structures defining the formats supported.

pcActual
UInt32[]

[out] Pointer to a count of formats in the rgcfformats array actually returned.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

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.

Applies to