IVsRunningDocumentTable2::FindAndLockDocumentEx Method (UInt32, String^, IVsHierarchy^, UInt32, IVsHierarchy^, UInt32, IntPtr, UInt32)
Locates a document in the RDT using the document file name, then obtains a read or edit lock on that document.
Assembly: Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)
int FindAndLockDocumentEx( unsigned int grfRDTLockType, String^ pszMkDocument, IVsHierarchy^ pHierPreferred, unsigned int itemidPreferred, [OutAttribute] IVsHierarchy^% ppHierActual, [OutAttribute] unsigned int% pitemidActual, [OutAttribute] IntPtr% ppunkDocDataActual, [OutAttribute] unsigned int% pdwCookie )
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.
- 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::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
This method is similar to FindAndLockDocument but also allows the specification of a preferred hierarchy/itemid pair for the document in case an RDT_EditLock is desired and the document is currently registered with only a RDT_ReadLock with no hierarchy/itemid assigned. In this case FindAndLockDocument would have returned E_UNEXPECTED. This method will not register the document in the Running Document Table if it is not currently registered.
From vsshell80.idl:
HRESULT FindAndLockDocumentEx(
[in] VSRDTFLAGS grfRDTLockType,
[in] LPCOLESTR pszMkDocument,
[in] IVsHierarchy *pHierPreferred,
[in] VSITEMID itemidPreferred,
[out] IVsHierarchy **ppHierActual,
[out] VSITEMID *pitemidActual,
[out] IUnknown **ppunkDocDataActual,
[out] VSCOOKIE *pdwCookie
);