Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IMoniker::ParseDisplayName method

Converts a display name into a moniker.

Syntax


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

Parameters

pbc [in]

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

pmkToLeft [in]

A pointer to the IMoniker interface on the moniker that has been built out of the display name up to this point.

pszDisplayName [in]

The remaining display name to be parsed.

pchEaten [out]

A pointer to a variable that receives the number of characters in pszDisplayName that were consumed in this step.

ppmkOut [out]

A pointer to an IMoniker pointer variable that receives the interface pointer to the moniker that was built from pszDisplayName. When successful, the implementation must call AddRef on the new moniker; it is the caller's responsibility to call Release. If an error occurs, the implementation sets *ppmkOut to NULL.

Return value

This method can return the standard return valuesE_OUTOFMEMORY and E_UNEXPECTED, as well as the following values.

Return codeDescription
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.

 

This method can also return the errors associated with the IMoniker::BindToObject method.

Remarks

Notes to Callers

Moniker clients do not typically call 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 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 IParseDisplayName::ParseDisplayName.

There are different strategies for getting an IParseDisplayName pointer, as follows:

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.

Implementation-specific Notes

ImplementationNotes
Anti-moniker

This method returns E_NOTIMPL.

Class moniker

This method parses the display name by binding to itself for IParseDisplayName and asking the bound object to parse the display name into a moniker, as follows.

  hr = BindToObject(pbc, pmkToLeft, IID_IParseDisplayName, (void**)&ppdn);
  if (SUCCEEDED(hr)) {
    hr = ppdn->ParseDisplayName(pbc, lpszDisplayName, pchEaten, ppmkOut);
    ppdn->Release();
  }
  return hr;

This method tries to acquire an IParseDisplayName pointer, first by binding to the class factory for the object identified by the moniker and then by binding to the object itself. If either of these binding operations is successful, the file moniker passes the unparsed portion of the display name to the IParseDisplayName::ParseDisplayName method.

This method returns MK_E_SYNTAX if pmkToLeft is non-NULL.

File moniker

This method tries to acquire an IParseDisplayName pointer, first by binding to the class factory for the object identified by the moniker and then by binding to the object itself. If either of these binding operations is successful, the file moniker passes the unparsed portion of the display name to the IParseDisplayName::ParseDisplayName method.

Generic composite moniker

This method recursively calls IMoniker::ParseDisplayName on the rightmost component of the composite, passing everything else as the pmkToLeft parameter for that call.

Item moniker

If pmkToLeft is NULL, this method returns MK_E_SYNTAX. Otherwise, the method calls IMoniker::BindToObject on the pmkToLeft parameter, requesting an IOleItemContainer interface pointer. The method then calls IOleItemContainer::GetObject, requesting an IParseDisplayName interface pointer to the object identified by the moniker, and passes the display name to IParseDisplayName::ParseDisplayName.

OBJREF moniker

If pmkToLeft is not NULL, this method returns MK_E_SYNTAX.

Pointer moniker

This method queries the wrapped pointer for the IParseDisplayName interface and passes the display name to IParseDisplayName::ParseDisplayName.

URL moniker

Parses a full or partial URL string into a result moniker (ppmkOut). If szDisplayName represents a full URL string (for example, "http://foo.com/default.html"), the result is a new full URL moniker. If szDisplayName represents a partial URL string (for example, "..\default.html"), the result is a full URL that takes its context from either the bind context's SZ_URLCONTEXT object-parameter or from this URL moniker. For example, if the context moniker was "http://foo.com/pub/list.html" and szDisplayName was "..\default.html", the resulting URL moniker would represent "http://foo.com/default.html".

 

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

ObjIdl.h

IDL

ObjIdl.idl

IID

IID_IMoniker is defined as 0000000f-0000-0000-C000-000000000046

See also

MkParseDisplayName
IMoniker
IParseDisplayName

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.