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.
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.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
- 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.
See Also
Reference
IVsRunningDocumentTable Interface