IVsUIHierarchyWindow2.GetCurrentSelection Method (IVsHierarchy%, UInt32%, IVsMultiItemSelect%)

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

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

Syntax

‘선언
Function GetCurrentSelection ( _
    <OutAttribute> ByRef ppHier As IVsHierarchy, _
    <OutAttribute> ByRef pitemid As UInteger, _
    <OutAttribute> ByRef ppMIS As IVsMultiItemSelect _
) As Integer
‘사용 방법
Dim instance As IVsUIHierarchyWindow2
Dim ppHier As IVsHierarchy
Dim pitemid As UInteger
Dim ppMIS As IVsMultiItemSelect
Dim returnValue As Integer

returnValue = instance.GetCurrentSelection(ppHier, _
    pitemid, ppMIS)
int GetCurrentSelection(
    out IVsHierarchy ppHier,
    out uint pitemid,
    out IVsMultiItemSelect ppMIS
)
int GetCurrentSelection(
    [OutAttribute] IVsHierarchy^% ppHier, 
    [OutAttribute] unsigned int% pitemid, 
    [OutAttribute] IVsMultiItemSelect^% ppMIS
)
abstract GetCurrentSelection : 
        ppHier:IVsHierarchy byref * 
        pitemid:uint32 byref * 
        ppMIS:IVsMultiItemSelect byref -> int 
function GetCurrentSelection(
    ppHier : IVsHierarchy, 
    pitemid : uint, 
    ppMIS : IVsMultiItemSelect
) : int

Parameters

  • pitemid
    Type: System.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.

Return Value

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

.NET Framework Security

See Also

Reference

IVsUIHierarchyWindow2 Interface

IVsUIHierarchyWindow2 Members

GetCurrentSelection Overload

Microsoft.VisualStudio.Shell.Interop Namespace