Share via


IMoniker::ParseDisplayName

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This method converts a display name into a moniker.

Syntax

HRESULT ParseDisplayName( 
  IBindCtx* pbc, 
  IMoniker* pmkToLeft, 
  LPOLESTR* pszDisplayName, 
  ULONG* pchEaten, 
  IMoniker** ppmkOut
);

Parameters

  • pbc
    [in] Pointer to the IBindCtx interface on the bind context to be used in this binding operation.

    The bind context caches objects bound during the binding process, contains parameters that apply to all operations using the bind context, and provides the means by which the moniker implementation should retrieve information about its environment.

    For more information, see IBindCtx.

  • pmkToLeft
    [in] Pointer to the IMoniker interface on the moniker that has been built out of the display name up to this point.
  • pszDisplayName
    [in] Pointer to a null-terminated string that contains the remaining display name to be parsed. For Microsoft® Win32® applications, the LPOLESTR type indicates a wide character string (two bytes per character); otherwise, the string has one byte per character.
  • pchEaten
    [out] Pointer to the number of characters in pszDisplayName that were consumed in this step.
  • ppmkOut
    [out] Address of IMoniker* pointer variable that receives the interface pointer to the moniker that was built from pszDisplayName.

    When successful, the implementation must call the IUnknown::AddRef method on the new moniker; it is the caller's responsibility to call the IUnknown::Release method.

    If an error occurs, the implementation sets *ppmkOut to NULL.

Return Value

The method supports the standard return values E_OUTOFMEMORY and E_UNEXPECTED. The following table shows the additional return values for this method.

Value Description

S_OK

The parsing operation was completed successfully.

MK_E_SYNTAX

An error in the syntax of the input components (pmkToLeft, this moniker, and pszDisplayName).

For example, a file moniker returns this error if pmkToLeft is non-NULL, and an item moniker returns it if pmkToLeft is NULL.

IMoniker::BindToObject errors

Parsing display names may cause binding. Thus, any error associated with this function may be returned.

Remarks

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

Notes to Callers

Moniker clients do not typically call IMoniker::ParseDisplayName directly.

Instead, they call the MkParseDisplayName function when they want to convert a display name into a moniker (for example, in implementing the Links dialog box for a container application, or for implementing a macro language that supports references to objects outside the document).

That function first parses the initial portion of the display name itself.

It then calls IMoniker::ParseDisplayName on the moniker it has just created, passing the remainder of the display name and getting a new moniker in return; this step is repeated until the entire display name has been parsed.

Notes to Implementers

Your implementation may be able to perform this parsing by itself if your moniker class is designed to designate only certain kinds of objects.

Otherwise, you must get an IParseDisplayName interface pointer for the object identified by the moniker-so-far (that is, the composition of pmkToLeft and this moniker) and then return the results of calling the IParseDisplayName::ParseDisplayName method.

There are different strategies for getting an IParseDisplayName pointer:

  • You can try to get the object's CLSID (by calling the IPersist::GetClassID method on the object), and then call the CoGetClassObject function, requesting the IParseDisplayName interface on the class factory associated with that CLSID.
  • You can try to bind to the object itself to get an IParseDisplayName pointer.
  • You can try binding to the object identified by pmkToLeft to get an IOleItemContainer pointer, and then call the IOleItemContainer::GetObject method to get an IParseDisplayName pointer for the item.

Any objects that are bound should be registered with the bind context (see IBindCtx::RegisterObjectBound) to ensure that they remain running for the duration of the parsing operation.

Requirements

Header objidl.h, objidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

CoGetClassObject
MkParseDisplayName
IMoniker::BindToObject
IParseDisplayName
IPersist::GetClassID
IUnknown::AddRef
IUnknown::Release