IVsRunningDocumentTable.RegisterAndLockDocument Method

Creates an entry in the running document table when a document is created or opened.

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

Syntax

'Declaration
Function RegisterAndLockDocument ( _
    grfRDTLockType As UInteger, _
    pszMkDocument As String, _
    pHier As IVsHierarchy, _
    itemid As UInteger, _
    punkDocData As IntPtr, _
    <OutAttribute> ByRef pdwCookie As UInteger _
) As Integer
int RegisterAndLockDocument(
    uint grfRDTLockType,
    string pszMkDocument,
    IVsHierarchy pHier,
    uint itemid,
    IntPtr punkDocData,
    out uint pdwCookie
)
int RegisterAndLockDocument(
    [InAttribute] unsigned int grfRDTLockType, 
    [InAttribute] String^ pszMkDocument, 
    [InAttribute] IVsHierarchy^ pHier, 
    [InAttribute] unsigned int itemid, 
    [InAttribute] IntPtr punkDocData, 
    [OutAttribute] unsigned int% pdwCookie
)
abstract RegisterAndLockDocument : 
        grfRDTLockType:uint32 * 
        pszMkDocument:string * 
        pHier:IVsHierarchy * 
        itemid:uint32 * 
        punkDocData:IntPtr * 
        pdwCookie:uint32 byref -> int
function RegisterAndLockDocument(
    grfRDTLockType : uint, 
    pszMkDocument : String, 
    pHier : IVsHierarchy, 
    itemid : uint, 
    punkDocData : IntPtr, 
    pdwCookie : uint
) : int

Parameters

  • pszMkDocument
    Type: String

    [in] Path to the document.

  • punkDocData
    Type: IntPtr

    [in] The IUnknown interface of the document. A null value indicates no document object that can be persisted.

  • pdwCookie
    Type: UInt32%

    [out] Returns an abstract value representing the document in the RDT.

Return Value

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsRunningDocumentTable::RegisterAndLockDocument(
   [in] VSRDTFLAGS    grfRDTLockType,
   [in] LPCOLESTR     pszMkDocument,
   [in] IVsHierarchy *pHier,
   [in] VSITEMID      itemid,
   [in] IUnknown     *punkDocData,
   [out] VSCOOKIE    *pdwCookie
);

The punkDocData parameter represents the document data object to be registered. Whatever package that calls the RegisterAndLockDocument method creates that document object which must implement at the very least the IVsPersistDocData and IVsDocDataFileChangeControl interfaces.

.NET Framework Security

See Also

Reference

IVsRunningDocumentTable Interface

Microsoft.VisualStudio.Shell.Interop Namespace