Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2010
Visual Studio
Visual Studio SDK
 GetCurrentSelection Method
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2010/.NET Framework 4

Other versions are also available for the following:
Visual Studio SDK
IVsMonitorSelection..::.GetCurrentSelection Method

Returns the current project hierarchy, project item, and selection container for the current selection.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Visual Basic
Function GetCurrentSelection ( _
    <OutAttribute> ByRef ppHier As IntPtr, _
    <OutAttribute> ByRef pitemid As UInteger, _
    <OutAttribute> ByRef ppMIS As IVsMultiItemSelect, _
    <OutAttribute> ByRef ppSC As IntPtr _
) As Integer
C#
int GetCurrentSelection(
    out IntPtr ppHier,
    out uint pitemid,
    out IVsMultiItemSelect ppMIS,
    out IntPtr ppSC
)
Visual C++
int GetCurrentSelection(
    [OutAttribute] IntPtr% ppHier, 
    [OutAttribute] unsigned int% pitemid, 
    [OutAttribute] IVsMultiItemSelect^% ppMIS, 
    [OutAttribute] IntPtr% ppSC
)
F#
abstract GetCurrentSelection : 
        ppHier:IntPtr byref * 
        pitemid:uint32 byref * 
        ppMIS:IVsMultiItemSelect byref * 
        ppSC:IntPtr byref -> int 
JScript
function GetCurrentSelection(
    ppHier : IntPtr, 
    pitemid : uint, 
    ppMIS : IVsMultiItemSelect, 
    ppSC : IntPtr
) : int

Parameters

ppHier
Type: System..::.IntPtr%
[out] Pointer to the IVsHierarchy interface of the current project hierarchy if the selection belongs to a single hierarchy. If the selection belongs to multiple hierarchies, ppHier is set to nullNothingnullptra null reference (Nothing in Visual Basic).
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.
ppSC
Type: System..::.IntPtr%
[out] Pointer to the ISelectionContainer interface to be used to access data for the Properties window.

Return Value

Type: System..::.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

COM Signature

From vsshell.idl:

Visual C++
HRESULT IVsMonitorSelection::GetCurrentSelection(
   [out] IVsHierarchy        **ppHier,
   [out] VSITEMID             *pitemid,
   [out] IVsMultiItemSelect  **ppMIS,
   [out] ISelectionContainer **ppSC
);
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker