IVsObjectList.EnumClipboardFormats Method

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

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function EnumClipboardFormats ( _
    index As UInteger, _
    grfFlags As UInteger, _
    celt As UInteger, _
    <OutAttribute> rgcfFormats As VSOBJCLIPFORMAT(), _
    <OutAttribute> pcActual As UInteger() _
) As Integer
int EnumClipboardFormats(
    uint index,
    uint grfFlags,
    uint celt,
    VSOBJCLIPFORMAT[] rgcfFormats,
    uint[] pcActual
)
int EnumClipboardFormats(
    [InAttribute] unsigned int index, 
    [InAttribute] unsigned int grfFlags, 
    [InAttribute] unsigned int celt, 
    [OutAttribute] array<VSOBJCLIPFORMAT>^ rgcfFormats, 
    [OutAttribute] array<unsigned int>^ pcActual
)
abstract EnumClipboardFormats : 
        index:uint32 * 
        grfFlags:uint32 * 
        celt:uint32 * 
        rgcfFormats:VSOBJCLIPFORMAT[] byref * 
        pcActual:uint32[] byref -> int
function EnumClipboardFormats(
    index : uint, 
    grfFlags : uint, 
    celt : uint, 
    rgcfFormats : VSOBJCLIPFORMAT[], 
    pcActual : uint[]
) : int

Parameters

  • index
    Type: UInt32

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

  • grfFlags
    Type: UInt32

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

  • celt
    Type: UInt32

    [in] Specifies the element count of rgcfFormats.

  • pcActual
    Type: array<UInt32[]

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

Return Value

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsObjectList::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 will do the rendering through GetClipboardFormat. In the case of a multi-select, 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>.

Note

Only certain persistable VARIANT types are supported as covered in CComVariant::WriteToStream in the MSDN Library Platform SDK documentation set.

In the single select case, your object list is free to provide both traditional and composite formats and will be called respectively on GetClipboardFormat or GetExtendedClipboardVariant for each.

Note

Class View and Object Browser automatically provide a CF_NAVINFO and a CF_TEXT/CF_UNICODETEXT format, so EnumClipboardFormats should NOT return these values.

.NET Framework Security

See Also

Reference

IVsObjectList Interface

Microsoft.VisualStudio.Shell.Interop Namespace