次の方法で共有


IVsRunningDocumentTable2.FindAndLockDocumentEx Method

Locates a document in the RDT using the document file name, then obtains a read or edit lock on that document.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

Syntax

'宣言
Function FindAndLockDocumentEx ( _
    grfRDTLockType As UInteger, _
    pszMkDocument As String, _
    pHierPreferred As IVsHierarchy, _
    itemidPreferred As UInteger, _
    <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 ppHierActual As IVsHierarchy
Dim pitemidActual As UInteger
Dim ppunkDocDataActual As IntPtr
Dim pdwCookie As UInteger
Dim returnValue As Integer

returnValue = instance.FindAndLockDocumentEx(grfRDTLockType, _
    pszMkDocument, pHierPreferred, itemidPreferred, _
    ppHierActual, pitemidActual, ppunkDocDataActual, _
    pdwCookie)
int FindAndLockDocumentEx(
    uint grfRDTLockType,
    string pszMkDocument,
    IVsHierarchy pHierPreferred,
    uint itemidPreferred,
    out IVsHierarchy ppHierActual,
    out uint pitemidActual,
    out IntPtr ppunkDocDataActual,
    out uint pdwCookie
)
int FindAndLockDocumentEx(
    [InAttribute] unsigned int grfRDTLockType, 
    [InAttribute] String^ pszMkDocument, 
    [InAttribute] IVsHierarchy^ pHierPreferred, 
    [InAttribute] unsigned int itemidPreferred, 
    [OutAttribute] IVsHierarchy^% ppHierActual, 
    [OutAttribute] unsigned int% pitemidActual, 
    [OutAttribute] IntPtr% ppunkDocDataActual, 
    [OutAttribute] unsigned int% pdwCookie
)
abstract FindAndLockDocumentEx : 
        grfRDTLockType:uint32 * 
        pszMkDocument:string * 
        pHierPreferred:IVsHierarchy * 
        itemidPreferred:uint32 * 
        ppHierActual:IVsHierarchy byref * 
        pitemidActual:uint32 byref * 
        ppunkDocDataActual:IntPtr byref * 
        pdwCookie:uint32 byref -> int 
function FindAndLockDocumentEx(
    grfRDTLockType : uint, 
    pszMkDocument : String, 
    pHierPreferred : IVsHierarchy, 
    itemidPreferred : uint, 
    ppHierActual : IVsHierarchy, 
    pitemidActual : uint, 
    ppunkDocDataActual : IntPtr, 
    pdwCookie : uint
) : int

Parameters

  • pszMkDocument
    Type: System.String
    [in] Path to the located document.
  • 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

FindAndLockDocumentEx 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.

COM Signature

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

.NET Framework Security

See Also

Reference

IVsRunningDocumentTable2 Interface

IVsRunningDocumentTable2 Members

Microsoft.VisualStudio.Shell.Interop Namespace