IVsRunningDocumentTable::RegisterAndLockDocument Method (UInt32, String^, IVsHierarchy^, UInt32, IntPtr, UInt32)
Creates an entry in the running document table when a document is created or opened.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
int RegisterAndLockDocument( unsigned int grfRDTLockType, String^ pszMkDocument, IVsHierarchy^ pHier, unsigned int itemid, IntPtr punkDocData, [OutAttribute] unsigned int% pdwCookie )
Parameters
- grfRDTLockType
-
Type:
System::UInt32
[in] Flags taken from the _VSRDTFLAGS, _VSRDTFLAGS2, and _VSRDTFLAGS3 enumerations. The flags must include either RDT_EditLock or RDT_ReadLock.
- pszMkDocument
-
Type:
System::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:
System::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:
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::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
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.