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
grfRDTLockType
Type: UInt32[in] Flags taken from the _VSRDTFLAGS, _VSRDTFLAGS2, and _VSRDTFLAGS3 enumerations. The flags must include either RDT_EditLock or RDT_ReadLock.
pszMkDocument
Type: String[in] Path to the document.
pHier
Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy[in] Returns the IVsHierarchy interface of the hierarchy that owns the document. Can only be a null value if a read lock has been obtained.
itemid
Type: UInt32[in] Item identifier of the document in the hierarchy. This is a unique identifier or it can be one of the following values: VSITEMID_NIL, VSITEMID_ROOT, or VSITEMID_SELECTION.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.