IMoniker::ParseDisplayName method (objidl.h)
Converts a display name into a moniker.
HRESULT ParseDisplayName( [in] IBindCtx *pbc, [in] IMoniker *pmkToLeft, [in] LPOLESTR pszDisplayName, [out] ULONG *pchEaten, [out] IMoniker **ppmkOut );
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.
A pointer to the IMoniker interface on the moniker that has been built out of the display name up to this point.
The remaining display name to be parsed.
A pointer to a variable that receives the number of characters in pszDisplayName that were consumed in this step.
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.
This method can return the standard return valuesE_OUTOFMEMORY and E_UNEXPECTED, as well as the following values.
||The parsing operation was completed successfully.|
||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.
RemarksMkParseDisplayName 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.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:
- You can try to get the object's CLSID (by calling IPersist::GetClassID 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 IOleItemContainer::GetObject to get an IParseDisplayName pointer for the item.
|Anti-moniker||This method returns E_NOTIMPL.|
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.
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".|
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|