OleLockRunning function (ole2.h)

Locks an already running object into its running state or unlocks it from its running state.

Syntax

HRESULT OleLockRunning(
  [in] LPUNKNOWN pUnknown,
  [in] BOOL      fLock,
  [in] BOOL      fLastUnlockCloses
);

Parameters

[in] pUnknown

Pointer to the IUnknown interface on the object, which the function uses to query for a pointer to IRunnableObject.

[in] fLock

TRUE locks the object into its running state. FALSE unlocks the object from its running state.

[in] fLastUnlockCloses

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 function returns S_OK on success. Other possible values include the following.

Return code Description
E_OUTOFMEMORY
Insufficient memory for the operation.
E_INVALIDARG
One or more parameters are invalid.
E_UNEXPECTED
An unexpected error occurred.

Remarks

The OleLockRunning function saves you the trouble of calling the IRunnableObject::LockRunning method. You can use OleLockRunning and IRunnableObject::LockRunning interchangeably. With the IUnknown pointer passed in with the pUnknown parameter, OleLockRunning queries for an IRunnableObject pointer. If successful, it calls IRunnableObject::LockRunning and returns the results of the call.

For more information on using this function, see IRunnableObject::LockRunning.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ole2.h
Library Ole32.lib
DLL Ole32.dll

See also

CoLockObjectExternal

IRunnableObject::LockRunning

OleNoteObjectVisible