共用方式為


IVsMonitorSelection.GetCurrentSelection Method

Definition

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

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

Parameters

ppHier
IntPtr

nativeint

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

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.

ppSC
IntPtr

nativeint

[out] Pointer to the ISelectionContainer interface to be used to access data for the Properties window.

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsMonitorSelection::GetCurrentSelection(  
   [out] IVsHierarchy        **ppHier,  
   [out] VSITEMID             *pitemid,  
   [out] IVsMultiItemSelect  **ppMIS,  
   [out] ISelectionContainer **ppSC  
);  

Applies to