IVsRunningDocumentTable2.FindOrRegisterAndLockDocument Method
Adds a lock to a registered or unregistered document.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)
Syntax
‘선언
Function FindOrRegisterAndLockDocument ( _
grfRDTLockType As UInteger, _
pszMkDocument As String, _
pHierPreferred As IVsHierarchy, _
itemidPreferred As UInteger, _
punkDocData As IntPtr, _
<OutAttribute> ByRef ppHierActual As IVsHierarchy, _
<OutAttribute> ByRef pitemidActual As UInteger, _
<OutAttribute> ByRef ppunkDocDataActual As IntPtr, _
<OutAttribute> ByRef pdwCookie As UInteger _
) As Integer
‘사용 방법
Dim instance As IVsRunningDocumentTable2
Dim grfRDTLockType As UInteger
Dim pszMkDocument As String
Dim pHierPreferred As IVsHierarchy
Dim itemidPreferred As UInteger
Dim punkDocData As IntPtr
Dim ppHierActual As IVsHierarchy
Dim pitemidActual As UInteger
Dim ppunkDocDataActual As IntPtr
Dim pdwCookie As UInteger
Dim returnValue As Integer
returnValue = instance.FindOrRegisterAndLockDocument(grfRDTLockType, _
pszMkDocument, pHierPreferred, itemidPreferred, _
punkDocData, ppHierActual, pitemidActual, _
ppunkDocDataActual, pdwCookie)
int FindOrRegisterAndLockDocument(
uint grfRDTLockType,
string pszMkDocument,
IVsHierarchy pHierPreferred,
uint itemidPreferred,
IntPtr punkDocData,
out IVsHierarchy ppHierActual,
out uint pitemidActual,
out IntPtr ppunkDocDataActual,
out uint pdwCookie
)
int FindOrRegisterAndLockDocument(
[InAttribute] unsigned int grfRDTLockType,
[InAttribute] String^ pszMkDocument,
[InAttribute] IVsHierarchy^ pHierPreferred,
[InAttribute] unsigned int itemidPreferred,
[InAttribute] IntPtr punkDocData,
[OutAttribute] IVsHierarchy^% ppHierActual,
[OutAttribute] unsigned int% pitemidActual,
[OutAttribute] IntPtr% ppunkDocDataActual,
[OutAttribute] unsigned int% pdwCookie
)
abstract FindOrRegisterAndLockDocument :
grfRDTLockType:uint32 *
pszMkDocument:string *
pHierPreferred:IVsHierarchy *
itemidPreferred:uint32 *
punkDocData:IntPtr *
ppHierActual:IVsHierarchy byref *
pitemidActual:uint32 byref *
ppunkDocDataActual:IntPtr byref *
pdwCookie:uint32 byref -> int
function FindOrRegisterAndLockDocument(
grfRDTLockType : uint,
pszMkDocument : String,
pHierPreferred : IVsHierarchy,
itemidPreferred : uint,
punkDocData : IntPtr,
ppHierActual : IVsHierarchy,
pitemidActual : uint,
ppunkDocDataActual : IntPtr,
pdwCookie : uint
) : int
Parameters
- grfRDTLockType
Type: System.UInt32
[in] Flags whose values are taken from the _VSRDTFLAGS enumeration.
- pszMkDocument
Type: System.String
[in] Path to the located document.
- pHierPreferred
Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy
[out, optional] Returns preferred the IVsHierarchy interface for the located document.
- itemidPreferred
Type: System.UInt32
[out, optional] Returns an item identifier of the located document. 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
[out, optional] Returns the IUnknown interface.
- ppHierActual
Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy%
[out, optional] Returns the actual IVsHierarchy interface for the located document.
- pitemidActual
Type: System.UInt32%
[out, optional] Returns an item identifier of the located document. This is a unique identifier or it can be one of the following values: VSITEMID_NIL, VSITEMID_ROOT, or VSITEMID_SELECTION.
- ppunkDocDataActual
Type: System.IntPtr%
[out, optional] Returns the IUnknown interface.
- pdwCookie
Type: System.UInt32%
[out, optional] Returns an abstract value for the document.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
This method handles all cases to add a lock to a document whether the document is already registered or not. This is a convenience method that combines the functionality of RegisterAndLockDocument and FindAndLockDocumentEx. RegisterAndLockDocument returns an error if the document is already registered. FindAndLockDocumentEx returns an error if it is not registered. In the case where an RDT_EditLock is desired and the document is currently registered only with a RDT_ReadLock with no pHier/itemid assigned, this function will assign the preferred pHier/itemid to the document.
COM Signature
From vsshell80.idl:
HRESULT FindOrRegisterAndLockDocument(
[in] VSRDTFLAGS grfRDTLockType,
[in] LPCOLESTR pszMkDocument,
[in] IVsHierarchy *pHierPreferred,
[in] VSITEMID itemidPreferred,
[in] IUnknown *punkDocData,
[out] IVsHierarchy **ppHierActual,
[out] VSITEMID *pitemidActual,
[out] IUnknown **ppunkDocDataActual,
[out] VSCOOKIE *pdwCookie
);
.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.
See Also
Reference
IVsRunningDocumentTable2 Interface