Converts a string into a moniker that identifies the object named by the string. This is the inverse of the IMoniker::GetDisplayName operation, which retrieves the display name associated with a moniker.
WINOLEAPI MkParseDisplayName(
LPBC pbc, //Pointer to the bind context object
LPCOLESTR szUserName, //Pointer to display name
ULONG FAR *pchEaten, //Pointer to the number of characters
// consumed
LPMONIKER FAR *ppmk //Address of output variable that receives
// the IMoniker interface pointer
);
This function supports the standard return value E_OUTOFMEMORY, as well as the following:
This function can also return any of the error values returned by IMoniker::BindToObject, IOleItemContainer::GetObject, or IParseDisplayName::ParseDisplayName.
The MkParseDisplayName function parses a human-readable name into a moniker that can be used to identify a link source. The resulting moniker can be a simple moniker (such as a file moniker), or it can be a generic composite made up of the component moniker pieces. For example, the following display name:
"c:\mydir\somefile!item 1"
could be parsed into the following generic composite moniker:
(FileMoniker based on "c:\mydir\somefile") + (ItemMoniker based on "item 1")
The most common use of MkParseDisplayName is in the implementation of the standard Links dialog box, which allows an end user to specify the source of a linked object by typing in a string. You may also need to call MkParseDisplayName if your application supports a macro language that permits remote references (reference to elements outside of the document).
Parsing a display name often requires activating the same objects that would be activated during a binding operation, so it can be just as expensive (in terms of performance) as binding. Objects that are bound during the parsing operation are cached in the bind context passed to the function. If you plan to bind the moniker returned by MkParseDisplayName, it is best to do so immediately after the function returns, using the same bind context, which removes the need to activate objects a second time.
MkParseDisplayName parses as much of the display name as it understands into a moniker. The function then calls IMoniker::ParseDisplayName on the newly created moniker, passing the remainder of the display name. The moniker returned by IMoniker::ParseDisplayName is composed onto the end of the existing moniker and, if any of the display name remains unparsed, IMoniker::ParseDisplayName is called on the result of the composition. This process is repeated until the entire display name has been parsed.
The MkParseDisplayName function attempts the following strategies to parse the beginning of the display name, using the first one that succeeds:
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objbase.h.
Import Library: Included as a resource in ole32.dll.
IMoniker::ParseDisplayName, IMoniker::GetDisplayName, IParseDisplayName