Share via


IVsRunningDocumentTable2.FindOrRegisterAndLockDocument Method

Definition

Adds a lock to a registered or unregistered document.

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

Parameters

grfRDTLockType
UInt32

[in] Flags whose values are taken from the _VSRDTFLAGS enumeration.

pszMkDocument
String

[in] Path to the located document.

pHierPreferred
IVsHierarchy

[out, optional] Returns preferred the IVsHierarchy interface for the located document.

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

nativeint

[out, optional] Returns the IUnknown interface.

ppHierActual
IVsHierarchy

[out, optional] Returns the actual IVsHierarchy interface for the located document.

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

nativeint

[out, optional] Returns the IUnknown interface.

pdwCookie
UInt32

[out, optional] Returns an abstract value for the document.

Returns

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  
);  

Applies to