次の方法で共有


IVsSimpleObjectList2.EnumClipboardFormats Method

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

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

Syntax

'宣言
Function EnumClipboardFormats ( _
    index As UInteger, _
    grfFlags As UInteger, _
    celt As UInteger, _
    <OutAttribute> rgcfFormats As VSOBJCLIPFORMAT(), _
    <OutAttribute> pcActual As UInteger() _
) As Integer
'使用
Dim instance As IVsSimpleObjectList2
Dim index As UInteger
Dim grfFlags As UInteger
Dim celt As UInteger
Dim rgcfFormats As VSOBJCLIPFORMAT()
Dim pcActual As UInteger()
Dim returnValue As Integer

returnValue = instance.EnumClipboardFormats(index, _
    grfFlags, celt, rgcfFormats, pcActual)
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: System.UInt32
    [in] Specifies the index of the list item of interest.
  • celt
    Type: System.UInt32
    [in] Specifies the element count of rgcfFormats.
  • pcActual
    Type: array<System.UInt32[]
    [out] Pointer to a count of formats in the rgcfformats array actually returned.

Return Value

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

Remarks

COM Signature

From vsshell80.idl:

HRESULT IVsSimpleObjectList2::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 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. See CComVariant::WriteToStream for more information.

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.

.NET Framework Security

See Also

Reference

IVsSimpleObjectList2 Interface

IVsSimpleObjectList2 Members

Microsoft.VisualStudio.Shell.Interop Namespace