|
IOleClientSite::GetMoniker
Returns a moniker to an object's client site. An object can force the
assignment of its own or its container's moniker by specifying a value for dwAssign.
HRESULT GetMoniker(
DWORD dwAssign,
| //Value specifying how moniker is assigned
| DWORD dwWhichMoniker,
| //Value specifying which moniker is assigned
| IMoniker ** ppmk
| //Pointer to storage of returned moniker
| );
|
|
Parameters
dwAssign
[in] Specifies whether to get a moniker only if one has already exists, force
assignment of a moniker, create a temporary moniker, or remove a moniker that
has been assigned. In practice you will usually request that the container force
assignment of the moniker. Values defining these choices are contained in the
enumeration OLEGETMONIKER.
dwWhichMoniker
[in] Specifies whether to return the container's moniker, the object's moniker
relative to the container, or the object's full moniker. In practice, you will
usually request the object's full moniker. Values defining these choices are
contained in the enumeration OLEWHICHMK.
ppmk
[out] Points to where to return the object moniker. If an error is returned,
this parameter must be set to NULL. Each time a container receives a call to IOleClientSite::GetMoniker, it must increase the reference count on the pointer it returns. It is the
caller's responsibility to call Release when it is done with the pointer.
Return Values
S_OK
Requested moniker returned successfully.
E_FAIL
An unspecified error occurred.
E_UNEXPECTED
A serious, unexpected failure has occurred.
E_NOTIMPL
This container cannot assign monikers to objects. This is the case with OLE 1
containers.
Comments
Containers implement IOleClientSite::GetMoniker as a way of passing out monikers for their embedded objects to clients
wishing to link to those objects.
When a link is made to an embedded object or to a pseudo-object within it (a
range of cells in a spreadsheet; for example), the object needs a moniker to
construct the composite moniker indicating the source of the link. If the embedded
object does not already have a moniker, it can call IOleClientSite::GetMoniker to request one.
Every container that expects to contain links to embeddings should support IOleClientSite::GetMoniker to give out OLEWHICHMK_CONTAINER, thus enabling link tracking when the link
client and link source files move, but maintain the same relative position.
An object must not persistently store its full moniker or its container's
moniker, because these can change while the object is not loaded. For example,
either the container or the object could be renamed, in which event, storing the
container's moniker or the object's full moniker would make it impossible to for
a client to track a link to the object.
In some very specialized cases, an object may no longer need a moniker
previously assigned to it and may wish to have it removed as an optimization. In such
cases, the object can call IOleClientSite::GetMoniker with OLEGETMONIKER_UNASSIGN to have the moniker removed.
See Also
IOleObject::GetMoniker, IOleObject::SetMoniker
Related LinksSoftware for Delphi and C++ Builder developers Software for Visual Studio .NET developers Software for Visual Basic 6 developers Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps Win32 Programmer's Reference (win32.hlp) Win32 Multimedia Programmer's Reference (mmedia.hlp) Microsoft Windows Pen API Programmer's Reference (penapi.hlp) Microsoft Windows Sockets 2 Reference (sock2.hlp) Microsoft Windows Telephony API (TAPI) Programmer's Reference (sock2.hlp) Unix Manual Pages
|