IVsRunningDocumentTable.RegisterAndLockDocument Method

Definition

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

public:
 int RegisterAndLockDocument(System::UInt32 grfRDTLockType, System::String ^ pszMkDocument, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pHier, System::UInt32 itemid, IntPtr punkDocData, [Runtime::InteropServices::Out] System::UInt32 % pdwCookie);
public int RegisterAndLockDocument (uint grfRDTLockType, string pszMkDocument, Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHier, uint itemid, IntPtr punkDocData, out uint pdwCookie);
abstract member RegisterAndLockDocument : uint32 * string * Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * uint32 * nativeint * uint32 -> int
Public Function RegisterAndLockDocument (grfRDTLockType As UInteger, pszMkDocument As String, pHier As IVsHierarchy, itemid As UInteger, punkDocData As IntPtr, ByRef pdwCookie As UInteger) As Integer

Parameters

grfRDTLockType
UInt32

[in] Flags taken from the _VSRDTFLAGS, _VSRDTFLAGS2, and _VSRDTFLAGS3 enumerations. The flags must include either RDT_EditLock or RDT_ReadLock.

pszMkDocument
String

[in] Path to the document.

pHier
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
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
IntPtr

nativeint

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

pdwCookie
UInt32

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

Returns

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

Remarks

This method must be accessed on the main thread.

Applies to