Disconnects all remote process connections being maintained on behalf of all the interface pointers that point to a specified object. Only the process that actually manages the object should call CoDisconnectObject.
STDAPI CoDisconnectObject(
IUnknown * pUnk, |
//Pointer to the interface on the object |
DWORD dwReserved |
//Reserved for future use |
); |
Parameters
Return Values
Remarks
The CoDisconnectObject function enables a server to correctly disconnect all external clients to the object specified by pUnk.
The CoDisconnectObject function performs the following tasks:
An object’s client does not call CoDisconnectObject to disconnect itself from the server (clients should use IUnknown::Release for this purpose). Rather, an OLE server calls CoDisconnectObject to forcibly disconnect an object’s clients, usually in response to a user closing the server application.
Similarly, an OLE container that supports external links to its embedded objects can call CoDisconnectObject to destroy those links. Again, this call is normally made in response to a user closing the application. The container should first call IOleObject::Close for all its OLE objects, each of which should send IAdviseSink::OnClose notifications to their various clients. Then the container can safely call CoDisconnectObject to close any existing connections.
See Also
IOleObject::Close, IMarshal::DisconnectObject