Disconnects all remote process connections being maintained on behalf of all the interface pointers on a specified object. Only the process that actually manages the object should call CoDisconnectObject.

STDAPI CoDisconnectObject(

IUnknown * pUnk,
//Points to the object
DWORD dwReserved
//Reserved for future use



Points to the object to be disconnected. This does not necessarily have to be an IUnknown pointer. It can be a pointer to any interface supported by the object, as long as the interface is derived from IUnknown.


Reserved for future use; must be zero.

Return Values


Indicates all connections to remote processes were successfully deleted.


Out of memory.


Indicates one or more arguments are invalid.


Indicates an unexpected error occurred.


Indicates an unspecified error occurred.


The CoDisconnectObject function is not used in the typical course of processing (clients of interfaces should use IUnknown::Release). The primary purpose of CoDisconnectObject is to give an application control over connections from other processes that were made to objects managed by the application. For example, suppose an OLE container loads an embedded object and then links are established between the embedded object and outside containers. If the container application wants to exit, it is not appropriate for these remote connections to keep the object active beyond the lifetime of its container. When the object's container closes, such links should be disconnected. To forcefully close any existing connection(s), the object's container can call CoDisconnectObject.

Before calling CoDisconnectObject, the container should first call IOleObject::Close for all OLE objects. The objects will send OnClose notifications to inform all clients of the impending closure.

Calling this function is a privileged operation, to be invoked only by the process in which the object is actually managed.

See Also


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