Share 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

'Declaration
Function UnlockDocument ( _
    grfRDTLockType As UInteger, _
    dwCookie As UInteger _
) As Integer
int UnlockDocument(
    uint grfRDTLockType,
    uint dwCookie
)
int UnlockDocument(
    [InAttribute] unsigned int grfRDTLockType, 
    [InAttribute] unsigned int dwCookie
)
abstract UnlockDocument : 
        grfRDTLockType:uint32 * 
        dwCookie:uint32 -> int
function UnlockDocument(
    grfRDTLockType : uint, 
    dwCookie : uint
) : int

Parameters

  • grfRDTLockType
    Type: 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: UInt32

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

Return Value

Type: 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.

.NET Framework Security

See Also

Reference

IVsRunningDocumentTable Interface

Microsoft.VisualStudio.Shell.Interop Namespace