Calls the IUnknown::AddRef method on the specified object to ensure that the object remains active until the bind context is released. The method stores a pointer to the object in the bind context's internal list of pointers.

HRESULT RegisterObjectBound(

IUnknown *punk
//Pointer to the object being registered



[in] Points to the object that is being registered as bound.

Return Values


The object was successfully registered.


Indicates insufficient memory.


Notes to Callers

If you are writing your own moniker class (that is, implementing the IMoniker interface), you should call this method whenever your implementation activates an object. This happens most often in the course of binding a moniker, but it can also happen while retrieving a moniker's display name, parsing a display name into a moniker, or retrieving the time an object was last modified.

Calling the IBindCtx::RegisterObjectBound creates an additional reference to the passed-in object (via IUnknown::AddRef ); you are still required to release your own copy of the pointer. Note that calling this method twice for the same object creates two references to that object; you can release a reference to an object using the IBindCtx::RevokeObjectBound method. All references held by the bind context are released when the bind context itself is released.

Registering an object with a bind context keeps the object active until the bind context is released. Reusing a bind context in a subsequent binding operation (either for another piece of the same composite moniker, or for a different moniker) can make the subsequent binding operation more efficient because it doesn't have to reload that object. This performance improvement is present only if the subsequent binding operation requires some of the same objects as the original one. This performance improvement should be balanced against the costs of keeping objects activated unnecessarily.

Note that IBindCtx does not provide a method to retrieve a pointer to an object registered using IBindCtx::RegisterObjectBound. Assuming the object has registered itself with the Running Object Table, moniker implementations can use the Running Object Table to retrieve a pointer to the object.

See Also

IBindCtx::ReleaseBoundObjects, IBindCtx::RevokeObjectBound, IRunningObjectTable::GetObject

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database