IMoniker::ParseDisplayName  16.SDQK

Reads as many characters of the specified display name as it understands and builds a moniker corresponding to the portion read; this procedure is known as  parsing  the display name.

HRESULT ParseDisplayName(

    IBindCtx *pbc,

//Pointer to bind context to be used

    IMoniker *pmkToLeft,

//Pointer to moniker to the left in the composite

    LPOLESTR pszDisplayName,

//Pointer to display name

    ULONG *pchEaten,

//Pointer to number of characters consumed

    IMoniker **ppmkOut

//Indirect pointer to moniker built from display name

   );

 

 

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 IBindCtx1JJ0LSF.

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 zero-terminated string containing the remaining display name to be parsed. For 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] When successful, indirect pointer to the IMoniker interface on the moniker that was built from pszDisplayName. In this case, the implementation must call IUnknown::AddRef1SHW0SS on the parameter; it is the caller s responsibility to call IUnknown::ReleaseDUW01A. If an error occurs, the implementation sets ppmkOut to NULL.

 

Return Values

The method supports the standard return values E_OUTOFMEMORY and E_UNEXPECTED, as well as the following:

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

Notes to Callers

Moniker clients do not typically call IMoniker::ParseDisplayName directly. Instead, they call the MkParseDisplayName2DJJ.25 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 IParseDisplayNameQD_Z28 interface pointer for the object identified by the moniker-so-far (i.e., the composition of pmkToLeft and this moniker) and then return the results of calling IParseDisplayName::ParseDisplayNameLEMM77.

There are different strategies for getting an IParseDisplayName pointer:

    You can try to get the object s CLSID (by calling IPersist::GetClassID15MI_PE on the object), and then call the CoGetClassObject2_47ZR8 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 IOleItemContainer::GetObject to get an IParseDisplayNameQD_Z28 pointer for the item.

 

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

See Also

IParseDisplayName, MkParseDisplayName