Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This method notifies an object of one of the following:
- Its container's moniker
- The object's own moniker relative to the container
- The object's full moniker
Syntax
HRESUTL SetMoniker( DWORD dwWhichMoniker, IMoniker* pmk ); |
Parameters
- dwWhichMoniker
-
[in] Specifies which moniker is passed in pmk.
Values are from the enumeration OLEWHICHMK.
- pmk
-
[in] Pointer to where to return the moniker.
Return Value
This method supports the standard return value E_FAIL, as well as S_OK, which indicates that the moniker successfully set.
Remarks
A container that supports links to embedded objects must be able to inform an embedded object when its moniker has changed. Otherwise, subsequent attempts by link clients to bind to the object fail. The SetMonikermethod provides one way for a container to communicate this information.
The container can pass one of the following:
- Its own moniker
- An object's moniker relative to the container
- An object's full moniker
In practice, if a container passes anything other than an object's full moniker, each object calls the container back to request assignment of the full moniker, which the object requires to register itself in the running object table.
The moniker of an object relative to its container is stored by the object handler as part of the object's persistent state. However, the moniker of the object's container must not be persistently stored inside the object because the container can be renamed at any time.
To determine whether the platform supports this interface, see Determining Supported COM APIs.
Notes to Callers
A container calls SetMonikerwhen the container is renamed, and the container's embedded objects currently or potentially serve as link sources.
Containers call SetMonikermainly in the context of linking because an embedded object is already aware of its moniker. Even in the context of linking, calling this method is optional because objects can call IOleClientSite::GetMonikerto force assignment of a new moniker.
Note to Implementers
Upon receiving a call to SetMoniker, an object should register its full moniker in the running object table and send OnRenamenotification to all advise sinks that exist for the object.
Requirements
Header | Oleidl.h, oleidl.idl |
Library | oleaut32.lib, uuid.lib |
Windows Embedded CE | Windows CE 2.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |