Partager via


ISelectionContainer.SelectObjects Method

Returns one or more objects selected from a group of objects.

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

Syntax

'Declaration
Function SelectObjects ( _
    cSelect As UInteger, _
    apUnkSelect As Object(), _
    dwFlags As UInteger _
) As Integer
int SelectObjects(
    uint cSelect,
    Object[] apUnkSelect,
    uint dwFlags
)
int SelectObjects(
    [InAttribute] unsigned int cSelect, 
    [InAttribute] array<Object^>^ apUnkSelect, 
    [InAttribute] unsigned int dwFlags
)
abstract SelectObjects : 
        cSelect:uint32 * 
        apUnkSelect:Object[] * 
        dwFlags:uint32 -> int
function SelectObjects(
    cSelect : uint, 
    apUnkSelect : Object[], 
    dwFlags : uint
) : int

Parameters

  • cSelect
    Type: UInt32

    [in] Specifies the number of selected items—the number of elements in the array of objects returned by GetObjects and saved in apUnkSelect.

  • apUnkSelect
    Type: array<Object[]

    [in][out] Pointer to the array of objects returned through GetObjects.

  • dwFlags
    Type: UInt32

    [in] Flags that modify the selection. If set to SELOBJS_ACTIVATEWINDOW, the caller is requesting that the window showing the selected objects should be activated.

Return Value

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

Remarks

COM Signature

From designer.idl:

HRESULT ISelectionContainer::SelectObjects(
   [in] ULONG cSelect,
   [in, size_is(cSelect)] IUnknown ** apUnkSelect,
   [in] DWORD dwFlags
);

This method makes it possible for any of the selectable objects returned by GetObjects to be selected. Before returning, SelectObjects saves a local copy of its ISelectionContainer pointer by calling ISelectionContainer.AddRef and then reporting the changed selection to the environment with a call to OnSelectChange.

Because the returned objects support IDispatch, the caller can obtain information such as their name by calling either IDispatch.Invoke with a predefined dispatch identifier (DISPID) that represents the desired information. Declared DISPIDs are negative to ensure they do not conflict with user-defined identifiers.

The following table describes some of this information and where from and how it is obtained. These DISPIDs are defined in the header file Typelib2.h.

Information

Obtained From

Object name

IDispatch.Invoke using the DISPID_NAME dispatch identifier

Object index

IDispatch.Invoke using the DISPID_OBJECT dispatch identifier

Object type

IProvideClassInfo.QueryInterface

.NET Framework Security

See Also

Reference

ISelectionContainer Interface

Microsoft.VisualStudio.Shell.Interop Namespace