ISelectionContainer.SelectObjects(UInt32, Object[], UInt32) Method


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

 int SelectObjects(System::UInt32 cSelect, cli::array <System::Object ^> ^ apUnkSelect, System::UInt32 dwFlags);
 int SelectObjects(unsigned int cSelect, Platform::Array <Platform::Object ^> ^ apUnkSelect, unsigned int dwFlags);
int SelectObjects(unsigned int cSelect, std::Array <winrt::Windows::Foundation::IInspectable const &> const & apUnkSelect, unsigned int dwFlags);
public int SelectObjects (uint cSelect, object[] apUnkSelect, uint dwFlags);
abstract member SelectObjects : uint32 * obj[] * uint32 -> int
Public Function SelectObjects (cSelect As UInteger, apUnkSelect As Object(), dwFlags As UInteger) As Integer



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


[in][out] Pointer to the array of objects returned through GetObjects(UInt32, UInt32, Object[]).


[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.



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


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

Applies to