IVsUIHierarchyWindow.GetCurrentSelection Method
Gets the alternate itemID of the current selection when an alternate UIHierarchy is used.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'宣言
Function GetCurrentSelection ( _
<OutAttribute> ByRef ppHier As IntPtr, _
<OutAttribute> ByRef pitemid As UInteger, _
<OutAttribute> ByRef ppMIS As IVsMultiItemSelect _
) As Integer
'使用
Dim instance As IVsUIHierarchyWindow
Dim ppHier As IntPtr
Dim pitemid As UInteger
Dim ppMIS As IVsMultiItemSelect
Dim returnValue As Integer
returnValue = instance.GetCurrentSelection(ppHier, _
pitemid, ppMIS)
int GetCurrentSelection(
out IntPtr ppHier,
out uint pitemid,
out IVsMultiItemSelect ppMIS
)
int GetCurrentSelection(
[OutAttribute] IntPtr% ppHier,
[OutAttribute] unsigned int% pitemid,
[OutAttribute] IVsMultiItemSelect^% ppMIS
)
abstract GetCurrentSelection :
ppHier:IntPtr byref *
pitemid:uint32 byref *
ppMIS:IVsMultiItemSelect byref -> int
function GetCurrentSelection(
ppHier : IntPtr,
pitemid : uint,
ppMIS : IVsMultiItemSelect
) : int
Parameters
- ppHier
Type: System.IntPtr%
[out] Pointer to the IVsHierarchy interface of the current project hierarchy.
- 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.
- ppMIS
Type: Microsoft.VisualStudio.Shell.Interop.IVsMultiItemSelect%
[out] Pointer to the IVsMultiItemSelect interface to be used to access a multiple selection.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From vsshell.idl:
HRESULT IVsUIHierarchyWindow::GetCurrentSelection(
[out] IVsHierarchy ** ppHier,
[out] VSITEMID * pitemid,
[out] IVsMultiItemSelect ** ppMIS
);
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.