Stores an IUnknown pointer on the specified object under the specified key in the bind context's string-keyed table of pointers. The method must call IUnknown::AddRef on the stored pointer.
HRESULT RegisterObjectParam(
LPOLESTR pszKey, //Pointer to the key to be used
IUnknown *punk //Pointer to the object to be associated with
// the key
);
This method supports the standard return value E_OUTOFMEMORY, as well as the following:
A bind context maintains a table of interface pointers, each associated with a string key. This enables communication between a moniker implementation and the caller that initiated the binding operation. One party can store an interface pointer under a string known to both parties so that the other party can later retrieve it from the bind context.
Binding operations subsequent to the use of this method can use IBindCtx::GetObjectParam to retrieve the stored pointer.
IBindCtx::RegisterObjectParam is useful to those implementing a new moniker class (through an implementation of IMoniker) and to moniker clients (those who use monikers to bind to objects).
In implementing a new moniker class, you call this method when an error occurs during moniker binding to inform the caller of the cause of the error. The key that you would obtain with a call to this method would depend on the error condition. The following lists common moniker binding errors, describing for each the keys that would be appropriate:
If you're a moniker client with detailed knowledge of the implementation of the moniker you're using, you can also call this method to pass private information to that implementation.
You can define new strings as keys for storing pointers. By convention, you should use key names that begin with the string form of the CLSID of the moniker class (see the StringFromCLSID function).
If the pszKey parameter matches the name of an existing key in the bind context's table, the new object replaces the existing object in the table.
When you register an object using this method, the object is not released until one of the following occurs:
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objidl.h.
IBindCtx::GetObjectParam, IBindCtx::RevokeObjectParam, IBindCtx::EnumObjectParam