Partager via


IVsHierarchy.AdviseHierarchyEvents Method

Establishes client notification of hierarchy events without the hierarchy implementing IConnectionPointContainer.

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

Syntax

'Declaration
Function AdviseHierarchyEvents ( _
    pEventSink As IVsHierarchyEvents, _
    <OutAttribute> ByRef pdwCookie As UInteger _
) As Integer
int AdviseHierarchyEvents(
    IVsHierarchyEvents pEventSink,
    out uint pdwCookie
)
int AdviseHierarchyEvents(
    [InAttribute] IVsHierarchyEvents^ pEventSink, 
    [OutAttribute] unsigned int% pdwCookie
)
abstract AdviseHierarchyEvents : 
        pEventSink:IVsHierarchyEvents * 
        pdwCookie:uint32 byref -> int
function AdviseHierarchyEvents(
    pEventSink : IVsHierarchyEvents, 
    pdwCookie : uint
) : int

Parameters

  • pdwCookie
    Type: UInt32%

    [out] Pointer to a unique identifier for the referenced event sink. This value is required to unadvise the event sink using UnadviseHierarchyEvents.

Return Value

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

Remarks

Use this method to set up notification of hierarchy events on a particular object by synchronizing the hierarchy window to the hierarchy events. For example, when you add an item in the Solution Explorer window, the hierarchy to which the item is added notifies the listener that has registered as a sink for the event. Based on this event, the Solution Explorer window can then add the new item to the hierarchy.

COM Signature

From vsshell.idl:

HRESULT IVsHierarchy::AdviseHierarchyEvents(
   [in] IVsHierarchyEvents *pEventSink,
   [out] VSCOOKIE *pdwCookie
);

.NET Framework Security

See Also

Reference

IVsHierarchy Interface

Microsoft.VisualStudio.Shell.Interop Namespace