Udostępnij za pośrednictwem


IVsUIHierarchyWindow2.GetCurrentSelection Method

Definition

Gets the alternate itemID of the current selection when an alternate UIHierarchy is used.

public:
 int GetCurrentSelection([Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ % ppHier, [Runtime::InteropServices::Out] System::UInt32 % pitemid, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsMultiItemSelect ^ % ppMIS);
int GetCurrentSelection([Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & & ppHier, [Runtime::InteropServices::Out] unsigned int & pitemid, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsMultiItemSelect const & & ppMIS);
public int GetCurrentSelection (out Microsoft.VisualStudio.Shell.Interop.IVsHierarchy ppHier, out uint pitemid, out Microsoft.VisualStudio.Shell.Interop.IVsMultiItemSelect ppMIS);
abstract member GetCurrentSelection : IVsHierarchy * uint32 * IVsMultiItemSelect -> int
Public Function GetCurrentSelection (ByRef ppHier As IVsHierarchy, ByRef pitemid As UInteger, ByRef ppMIS As IVsMultiItemSelect) As Integer

Parameters

ppHier
IVsHierarchy

[out] Pointer to the IVsHierarchy interface of the current project hierarchy.

pitemid
UInt32

[out] Pointer to the identifier for the current project item. If pitemid is set to VSITEMID_SELECTION, the current selection involves multiple items. These items can be accessed using the IVsMultiItemSelect interface pointed to by ppMIS.

ppMIS
IVsMultiItemSelect

[out] Pointer to the IVsMultiItemSelect interface to be used to access a multiple selection.

Returns

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

Remarks

When there are no alternate UI hierarchy itemIDs, it is more common to use GetCurrentSelection to get the global currently active hierarchy itemID.

IVsUIHierarchyWindow::GetCurrentSelection is used when the selection within the local UI window has a different hierarchy itemID from the global hierarchy itemID. A UI window pushes a different hierarchy itemID to the global level if grfUIHWF is specified as UIHWF_PropagateAltHierarchyItem in Init.

The Macro Explorer and the Server Explorer are examples of tool windows that use a local UI window hierarchy itemID. In the Macro Explorer and Server Explorer, the IVsTrackSelectionEx implementation specifies the value HIERARCHY_DONTPROPAGATE (defined in vsshell.idl) so the locally selected UI hierarchy itemID does not get propagated to the global level. If HIERARCHY_DONTPROPAGATE is not selected, the local hierarchy itemID can be pushed to the global level.

Applies to