IVsRunningDocumentTable::UnlockDocument Method (UInt32, UInt32)

 

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)

int UnlockDocument(
	unsigned int grfRDTLockType,
	unsigned int dwCookie
)

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.

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.

Return to top
Show: