IMoniker::BindToStorage
Retrieves an
interface pointer to the storage that contains the object identified by the
moniker. Unlike the IMoniker::BindToObject
HRESULT BindToStorage(
IBindCtx *pbc, |
//Pointer to bind context to be used |
IMoniker *pmkToLeft, |
//Pointer to moniker to the left of this one in the
composite |
REFIID riid, |
//Reference to the identifier of the storage
interface requested |
void **ppvObj |
//Indirect pointer to interface on storage object
containing the identified object |
); |
|
Parameters
pbc
[in] Pointer
to the IBindCtx interface on the bind context object to be used during
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 IBindCtx
pmkToLeft
[in] If the
moniker is part of a composite moniker, pointer to the moniker to the left of
this moniker. This parameter is primarily used by moniker implementers to
enable cooperation between the various components of a composite moniker.
Moniker clients should pass NULL.
riid
[in]
Reference to the identifier of the storage interface requested, whose pointer
will be returned in ppvObj. Storage interfaces commonly requested
include IStorage
ppvObj
[out] Pointer
to the interface identified by riid on the storage of the object
identified by the moniker. If ppvObj is non-NULL, the implementation
must call IUnknown::AddRef
Return Values
The method
supports the standard return value E_OUTOFMEMORY, as well as the following:
S_OK
The binding
operation was successful.
MK_E_NOSTORAGE
The object
identified by this moniker does not have its own storage.
MK_E_EXCEEDEDDEADLINE
The operation
could not be completed within the time limit specified by the bind context s BIND_OPTS
MK_E_CONNECTMANUALLY
The operation
was unable to connect to the storage, possibly because a network device could
not be connected to. For more information, see IMoniker::BindToObject
MK_E_INTERMEDIATEINTERFACENOTSUPPORTED
An
intermediate object was found but it did not support an interface required for
an operation. For example, an item moniker returns this value if its container
does not support the IOleItemContainer interface.
STG_E_ACCESSDENIED
Unable to
access the storage object.
IOleItemContainer::GetObject errors
Binding to a
moniker containing an item moniker can return any of the errors associated with
this function.
Remarks
There is an
important difference between the IMoniker::BindToObject
Notes to Callers
Although none
of the OLE moniker classes call this method in their binding operations, it
might be appropriate to call it in the implementation of a new moniker class.
You could call this method in an implementation of IMoniker::BindToObject
A client that
can read the storage of the object its moniker identifies could also call this
method.
Notes to Implementers
Your
implementation should locate the persistent storage for the object identified
by the current moniker and return the desired interface pointer. Some types of
monikers represent pseudo-objects, which are objects that do not have their own
persistent storage. Such objects comprise some portion of the internal state of
its container; as, for example, a range of cells in a spreadsheet. If your
moniker class identifies this type of object, your implementation of IMoniker::BindToStorage
should return the error MK_E_NOSTORAGE.
If the bind
context s BIND_OPTS
See Also