OleLockRunning

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

WINOLEAPI OleLockRunning(
  LPUNKNOWN pUnknown,   //Pointer to interface
  BOOL fLock,           //Flag indicating whether object is locked
  BOOL fLastUnlockCloses
                        //Flag indicating whether to close object
);
 

Parameters

pUnknown
[in] Pointer to the IUnknown interface on the object, which the function uses to query for a pointer to IRunnableObject.
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 Values

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

S_OK
The object was successfully locked or unlocked.

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.

Note  The implementation of OleLockRunning in earlier versions of OLE differs from that described here.

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

QuickInfo

  Windows NT: Use version 3.1 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in ole2.h.
  Import Library: Included as a resource in ole32.dll.

See Also

CoLockObjectExternal, IRunnableObject::LockRunning, OleNoteObjectVisible