ISelectionContainer::SelectObjects Method (UInt32, array<Object^>^, UInt32)

 

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)

int SelectObjects(
	unsigned int cSelect,
	array<Object^>^ apUnkSelect,
	unsigned int dwFlags
)

Parameters

cSelect
Type: System::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<System::Object^>^

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

dwFlags
Type: System::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: System::Int32

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

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

Return to top
Show: