CoGetObject function (objbase.h)
Converts a display name into a moniker that identifies the object named, and then binds to the object identified by the moniker.
Syntax
HRESULT CoGetObject(
[in] LPCWSTR pszName,
[in, optional] BIND_OPTS *pBindOptions,
[in] REFIID riid,
[out] void **ppv
);
Parameters
[in] pszName
The display name of the object to be created.
[in, optional] pBindOptions
The binding options used to create a moniker that creates the actual object. For details, see BIND_OPTS. This parameter can be NULL.
[in] riid
A reference to the identifier of an interface that is implemented on the object to be created.
[out] ppv
The address of a pointer to the interface specified by riid on the object that is created.
Return value
This function can return the standard return values E_FAIL, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following values.
Return code | Description |
---|---|
|
The object was created successfully. |
|
The pszName parameter is not a properly formed display name. |
|
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. |
|
The binding operation could not be completed within the time limit specified by the BIND_OPTS structure passed in pBindOptions. |
|
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. |
|
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 IOleItemContainer interface. |
Remarks
CoGetObject encapsulates calls to the COM library functions CreateBindCtx, MkParseDisplayName, and IMoniker::BindToObject.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps | UWP apps] |
Minimum supported server | Windows 2000 Server [desktop apps | UWP apps] |
Target Platform | Windows |
Header | objbase.h |
Library | Ole32.lib |
DLL | Ole32.dll |