Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method locks an already running object into its running state or unlocks it from its running state.

Syntax

HRESULT LockRunning(
  BOOL 
fLock,
  BOOL 
fLastUnlockCloses 
);

Parameters

fLock

[in] TRUE locks the object into its running state.

FALSE unlocks the object from its running state.

fLastUnlockCloses

[in] TRUE specifies that if the connection being released is the last external lock on the object, the object should close.

FALSE specifies that the object should remain open until closed by the user or another process.

Return Value

This method supports the standard return values E_FAIL, E_INVALIDARG, E_OUTOFMEMORY and E_UNEXPECTED, as well as the following:

S_OK

If the value of fLockis TRUE, the object was successfully locked; if the value of fLockis FALSE, the object was successfully unlocked.

Remarks

Most implementations of IRunnableObject::LockRunningcall CoLockObjectExternal.

OleLockRunningis a helper function that conveniently repackages the functionality offered by IRunnableObject::LockRunning.

With the release of OLE 2.01, the implementation of OleLockRunningwas changed to call QueryInterface, ask for IRunnableObject, and then call IRunnableObject::LockRunning.

In other words, you can use the interface and the helper function interchangeably.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header objidl.h, objidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also