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 determines whether the object identified by the specified moniker is running, and if it is, retrieves a pointer to that object. This method looks for the moniker in the Running Object Table (ROT), and retrieves the pointer registered there.

Syntax

HRESULT GetObject(
  IMoniker* 
pmkObjectName,
  IUnknown** 
ppunkObject 
);

Parameters

pmkObjectName

[in] Pointer to the moniker to search for in the Running Object Table.

ppunkObject

[out] Address of IUnknown* pointer variable that receives the interface pointer to the running object.

When successful, the implementation calls AddRefon 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 * ppunkObjectto NULL.

Return Value

S_OK

Indicates that pmkObjectNamewas found in the ROT and a pointer was returned.

S_FALSE

There is no entry for pmkObjectNamein 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.

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

Notes to Callers

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

However, not all implementations of IMoniker::BindToObjectneed to call this method.

If you expect your moniker to have a prefix (indicated by a non-NULL pmkToLeftparameter 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

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