DocData.OnRegisterDocData Method

Assigns the document to a cookie and project hierarchy.

Namespace:  Microsoft.VisualStudio.Modeling.Shell
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Shell.11.0 (in Microsoft.VisualStudio.Modeling.Sdk.Shell.11.0.dll)


Public Function OnRegisterDocData ( _
    cookie As UInteger, _
    hierarchy As IVsHierarchy, _
    itemId As UInteger _
) As Integer
public int OnRegisterDocData(
    uint cookie,
    IVsHierarchy hierarchy,
    uint itemId
virtual int OnRegisterDocData(
    unsigned int cookie, 
    IVsHierarchy^ hierarchy, 
    unsigned int itemId
) sealed
abstract OnRegisterDocData : 
        cookie:uint32 * 
        hierarchy:IVsHierarchy * 
        itemId:uint32 -> int  
override OnRegisterDocData : 
        cookie:uint32 * 
        hierarchy:IVsHierarchy * 
        itemId:uint32 -> int
public final function OnRegisterDocData(
    cookie : uint, 
    hierarchy : IVsHierarchy, 
    itemId : uint
) : int


  • cookie
    Type: UInt32

    The handle that represents the document in the hierarchy.

  • itemId
    Type: UInt32

    The Item ID that is assigned to the document in the hierarchy.

Return Value

Type: Int32
S_OK if the method succeeds; otherwise, it returns an error code.


IVsPersistDocData2.OnRegisterDocData(UInt32, IVsHierarchy, UInt32)
IVsPersistDocData.OnRegisterDocData(UInt32, IVsHierarchy, UInt32)


This method is called when the Running Documents table registers the document in the project hierarchy.

This method invokes the IVsHierarchy interface.

Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.

The OnRegisterDocData method also allows derived classes to handle the event without attaching a delegate. This technique is recommended for handling the event in a derived class.

Notes to Inheritors

When you override OnRegisterDocData in a derived class, be sure to call the base class’s OnRegisterDocData method so that registered delegates receive the event.

.NET Framework Security

See Also


DocData Class

Microsoft.VisualStudio.Modeling.Shell Namespace