IRunningObjectTable::GetObject method (objidl.h)

Determines whether the object identified by the specified moniker is running, and if it is, retrieves a pointer to that object.

Syntax

HRESULT GetObject(
  [in]  IMoniker *pmkObjectName,
  [out] IUnknown **ppunkObject
);

Parameters

[in] pmkObjectName

A pointer to the IMoniker interface on the moniker.

[out] ppunkObject

A pointer to an IUnknown pointer variable that receives the interface pointer to the running object. When successful, the implementation calls AddRef on the object; it is the caller's responsibility to call Release. If the object is not running or if an error occurs, the implementation sets *ppunkObject to NULL.

Return value

This method can return the following values.

Return code Description
S_OK
Indicates that pmkObjectName was found in the ROT and a pointer was retrieved.
S_FALSE
There is no entry for pmkObjectName in the ROT, or that the object it identifies is no longer running (in which case, the entry is revoked).

Remarks

This method checks the ROT for the moniker specified by pmkObjectName. If that moniker had previously been registered with a call to IRunningObjectTable::Register, this method returns the pointer that was registered at that time.

Notes to Callers

Generally, you call the IRunningObjectTable::GetObject method only if you are writing your own moniker class (that is, implementing the IMoniker interface). You typically call this method from your implementation of IMoniker::BindToObject.

However, note that not all implementations of IMoniker::BindToObject need to call this method. If you expect your moniker to have a prefix (indicated by a non-NULLpmkToLeft parameter to IMoniker::BindToObject), you should not check the ROT. The reason for this is that only complete monikers are registered with the ROT, and if your moniker has a prefix, your moniker is part of a composite and thus not complete. Instead, your moniker should request services from the object identified by the prefix (for example, the container of the object identified by your moniker).

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 objidl.h

See also

IMoniker::BindToObject

IRunningObjectTable