IRunnableObject::Run method

Forces an object to run.

Syntax


HRESULT Run(
  [in]  LPBINDCTX pbc
);

Parameters

pbc [in]

A pointer to the binding context of the run operation. See IBindCtx. This parameter can be NULL.

Return value

This method can return the standard return values E_INVALIDARG, E_UNEXPECTED, and S_OK.

Remarks

Containers call IRunnableObject::Run to force their objects to enter the running state. If the object is not already running, calling Run can be an expensive operation, on the order of many seconds. If the object is already running, then this method has no effect on the object.

Notes to Callers

When called on a linked object that has been converted to a new class since the link was last activated, IRunnableObject::Run may return OLE_E_CLASSDIFF. In this case, the client should call IOleLink::BindToSource.

OleRun is a helper function that conveniently repackages the functionality offered by IRunnableObject::Run. With the release of OLE 2.01, the implementation of OleRun was changed so that it calls QueryInterface, asks for IRunnableObject, and then calls IRunnableObject::Run. In other words, you can use the interface and the helper function interchangeably.

Notes to Implementers

The object should register in the running object table if it has a moniker assigned. The object should not hold any strong locks on itself; instead, it should remain in the unstable, unlocked state. The object should be locked when the first external connection is made to the object.

An embedded object must hold a lock on its embedding container while it is in the running state. The default handler provided by OLE 2 takes care of locking the embedding container on behalf of objects implemented by an EXE object application. Objects implemented by a DLL object application must explicitly put a lock on their embedding containers, which they do by first calling IOleClientSite::GetContainer to get a pointer to the container, then calling IOleContainer::LockContainer to actually place the lock. This lock must be released when IOleObject::Close is called.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

ObjIdl.h

IDL

ObjIdl.idl

IID

IID_IRunnableObject is defined as 00000126-0000-0000-C000-000000000046

See also

IRunnableObject
OleRun

 

 

Community Additions

ADD
Show:
© 2014 Microsoft