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

'宣言
Function RegisterAndLockDocument ( _
    grfRDTLockType As UInteger, _
    pszMkDocument As String, _
    pHier As IVsHierarchy, _
    itemid As UInteger, _
    punkDocData As IntPtr, _
    <OutAttribute> ByRef pdwCookie As UInteger _
) As Integer
'使用
Dim instance As IVsRunningDocumentTable
Dim grfRDTLockType As UInteger
Dim pszMkDocument As String
Dim pHier As IVsHierarchy
Dim itemid As UInteger
Dim punkDocData As IntPtr
Dim pdwCookie As UInteger
Dim returnValue As Integer

returnValue = instance.RegisterAndLockDocument(grfRDTLockType, _
    pszMkDocument, pHier, itemid, punkDocData, _
    pdwCookie)
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
)
function RegisterAndLockDocument(
    grfRDTLockType : uint, 
    pszMkDocument : String, 
    pHier : IVsHierarchy, 
    itemid : uint, 
    punkDocData : IntPtr, 
    pdwCookie : uint
) : int

Parameters

  • grfRDTLockType
    Type: System.UInt32

    [in] Flags taken from the _VSRDTFLAGS enumeration. The flags must include either RDT_EditLock or RDT_ReadLock.

  • punkDocData
    Type: System.IntPtr

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

  • pdwCookie
    Type: System.UInt32%

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

Return Value

Type: System.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.

Permissions

See Also

Reference

IVsRunningDocumentTable Interface

IVsRunningDocumentTable Members

Microsoft.VisualStudio.Shell.Interop Namespace