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 function converts a display name into a moniker that identifies the object named, and then binds to the object identified by the moniker.

Syntax

WINOLEAPI CoGetObject(
  LPCWSTR 
pszName,
  BIND_OPTS* 
pBindOptions,
  REFIID 
riid,
  void** 
ppv
);

Parameters

pszName

[in] Display name, in string format, of the object to be created.

pBindOptions

[in] Binding options used to create a moniker that creates the actual object.

riid

[in] Reference to the ID of an interface that is implemented on the object to be created.

ppv

[out] Address of a pointer to the interface specified by riidon the object that is created.

Return Value

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

S_OK

The object was created successfully.

MK_E_SYNTAX

The pszNameparameter is not a properly formed display name.

MK_E_NOOBJECT

The object identified by this moniker, or some object identified by the composite moniker of which this moniker is a part, could not be found.

MK_E_EXCEEDEDDEADLINE

The binding operation could not be completed within the time limit specified by the BIND_OPTSstructure passed in pBindOptions.

MK_E_CONNECTMANUALLY

The binding operation requires assistance from the end user. The most common reasons for returning this value are that a password is needed or that a floppy needs to be mounted.

MK_E_INTERMEDIATEINTERFACENOTSUPPORTED

An intermediate object was found but it did not support an interface required to complete the binding operation. For example, an item moniker returns this value if its container does not support the IOleItemContainerinterface.

Remarks

CoGetObjectencapsulates calls to the COM library functions CreateBindCtx, MkParseDisplayName, and IMoniker::BindToObject.

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

Requirements

Header objbase.h
Library ole32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also