Partager via


IVsRunningDocumentTable.UnlockDocument Method

Releases a read or edit lock on the open document.

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

Syntax

'Déclaration
Function UnlockDocument ( _
    grfRDTLockType As UInteger, _
    dwCookie As UInteger _
) As Integer
'Utilisation
Dim instance As IVsRunningDocumentTable
Dim grfRDTLockType As UInteger
Dim dwCookie As UInteger
Dim returnValue As Integer

returnValue = instance.UnlockDocument(grfRDTLockType, _
    dwCookie)
int UnlockDocument(
    uint grfRDTLockType,
    uint dwCookie
)
int UnlockDocument(
    [InAttribute] unsigned int grfRDTLockType, 
    [InAttribute] unsigned int dwCookie
)
function UnlockDocument(
    grfRDTLockType : uint, 
    dwCookie : uint
) : int

Parameters

  • grfRDTLockType
    Type: System.UInt32

    [in] Values are taken from the _VSRDTFLAGS enumeration. Use the RDT_RequestUnlock flag with this method to indicate what should happen if this is the last unlock, because the last unlock will cause the document to be saved.

  • dwCookie
    Type: System.UInt32

    [in] Abstract value representing the open document for which the read or edit lock is to be released.

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::UnlockDocument(
   [in] VSRDTFLAGS grfRDTLockType,
   [in] VSCOOKIE   dwCookie
);

The dwCookie parameter is same value that is returned from the FindAndLockDocument or RegisterAndLockDocument methods.

If it is inconvenient to remember the dwCookie, then remember the pszMkDocument and call the FindAndLockDocument method to retrieve the dwCookie, and then call the UnlockDocument method twice. However, there are performance implications in doing this.

Permissions

See Also

Reference

IVsRunningDocumentTable Interface

IVsRunningDocumentTable Members

Microsoft.VisualStudio.Shell.Interop Namespace