The URL moniker implementation of IMoniker is found on a URL moniker object, which also supports IUnknown and IAsyncMoniker. The IMoniker interface inherits its definition from IPersistStream as well as IUnknown and IPersistStream inherits from IPersist. Thus, the IMoniker implementation includes support for IPersistStream and IPersist.
The IAsyncMoniker interface is simply IUnknown (there are no additional methods). It is is used to allow clients to determine if a moniker supports asynchronous binding.
To get a pointer to the IMoniker interface on this object, call the CreateURLMoniker function.
Note The current URL Moniker implementation of IMoniker does not support asynchronous storage. Future implementations will do so.
If you’re a moniker client (that is, you’re using a moniker to get an interface pointer to an object), you typically don’t need to know the class of the moniker you’re using; you simply call methods using an IMoniker interface pointer.
If you’re a moniker provider (that is, you’re handing out monikers that identify your objects to make them accessible to moniker clients), you must use item monikers if the objects you’re identifying are contained within another object and can be individually identified using a string. You’ll also need to use another type of moniker (for example, file monikers) in order to identify the container object.
To use item monikers, you must use the CreateItemMoniker function to create the monikers. To allow your objects to be loaded when an item moniker is bound, the container of your objects must implement the IOleItemContainer interface.
The most common example of moniker providers are OLE applications that support linking. If your OLE application supports linking to objects smaller than a file-based documents, you need to use item monikers. For a server application that allows linking to a selection within a document, you use the item monikers to identify those objects. For a container application that allows linking to embedded objects, you use the item monikers to identify the embedded objects.
Remarks
IBindCtx::GetRunningObjectTable(&prot) prot->IsRunning(this)
If the object is already running, the moniker retrieves the running object with the following call:
prot->GetObject(this, &punk)
Then, the moniker calls QueryInterface for the requested interface.
If the class being called is not marked with the category CATID_AsyncAware, calls to IStream::Read or IStream::Write which reference data not yet available block until the data becomes available. These calls block in the traditional OLE sense. A message loop is entered which allows certain messages to be processed, and the IMessageFilter of the thread is called appropriately.
If the class is marked with the category CATID_AsyncAware, calls to IStream::Read or IStream::Write which reference data not yet available return E_PENDING.
The system implementation of URL Monikers supports the BindToStorage for stream objects on all URLs and for storage objects in the case where the designated resource is in fact a compound file. Future support for ILockBytes may also be added.
Since the URL Moniker supports asynchronous binding, the actual return value of its BindToStorage may vary depending on the object parameters established in the bind-context. However, the semantics of the bind operation are identical regardless of synchronous or asynchronous usage as described below:
Returns MK_S_REDUCED_TO_SELF and itself (this) in *ppmkReduced.
URL Monikers support composition of two URLs: a base URL composed with a relative URL. This composition is done according to the RFC on relative URLs. URL Monikers do not currently support the composition of a base URL moniker with a relative file moniker, although this may be supported in the future.
However, URL Monikers do support generic composition. If fOnlyIfNotGeneric==TRUE, the ComposeWith method returns MK_E_NEEDGENERIC. Otherwise, this method simply returns CreateGenericComposite(this, pmkRight, ppmkComposite). See the Win32 documentation for more information about IMoniker::ComposeWith.
Returns S_OK and sets *ppenumMoniker to NULL, indicating that the moniker does not contain sub-monikers.
Returns S_FALSE if the other moniker (pmkOtherMoniker) is not an URL moniker, which it checks using IPersist::GetClassID to see if the CLSID is CLSID_URLMoniker. If the other moniker is an URL moniker, it compares the display names of the monikers for equality, returning either S_OK if they are identical or S_FALSE if not.
Creates a hash value based on the URL string of the moniker. This hash value is identical when URL strings are identical, although it may also be identical for different URL strings. This method is used to speed up comparisons by reducing the amount of time that it is necessary to call IMoniker::IsEqual.
Returns S_OK if this moniker is currently running. Otherwise, it returns S_FALSE. The URL Moniker determines if it is running by first checking if it is equal to the newly running moniker by making the following call:
pmkNewlyRunning->IsEqual
Typically, this call an inexpensive operation. If this does not succeed, the moniker next checks to see if it is registered with the Running Object Table of the passed-in bind-context.
Returns the time of last change of an object that is registered in the running object table.
Returns MK_E_NOINVERSE.
Currently returns E_NOTIMPL. In the future, it may properly compute the proper common prefix of two URL monikers. See the Win32 documentation about IMoniker::CommonPrefixWith for details.
Currently returns E_NOTIMPL. In the future, it may properly compute the relative path between two URL monikers. See the Win32 documentation about IMoniker::RelativePathTo for details.
THe URL Moniker attempts to return its full URL string. If the moniker was created with a partial URL string (see CreateURLMoniker), it will first attempt to find an URL moniker in the bind-context under SZ_URLCONTEXT, and will next look to the moniker to its left for contextual information. If it can not return its full URL string, it will return its partial URL string.
Parses a full or partial URL string into a result moniker (ppmkOut). If szDisplayName represents a full URL string (i.e. “http://foo.com/default.html”), the result is a new full URL moniker. If szDisplayName represents a partial URL string (i.e. “..\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”.
Returns S_TRUE and MKSYS_URLMONIKER in *pdwMksys.
See Also
CreateURLMoniker, IPersistStream - URL Moniker Implementation