IMarshal::DisconnectObject method (objidl.h)
Releases all connections to an object. The object's server calls the object's implementation of this method prior to shutting down.
HRESULT DisconnectObject( [in] DWORD dwReserved );
This parameter is reserved and must be 0.
If the method succeeds, the return value is S_OK. Otherwise, it is E_FAIL.
This method is implemented on the object, not the proxy.IMarshal. Prior to shutting down, the server calls the CoDisconnectObject function to release external connections to all its running objects. For each object that implements IMarshal, however, this function calls DisconnectObject so that each object that manages its own marshaling can take steps to notify its proxy that it is about to shut down. CoDisconnectObject, which in turn calls DisconnectObject, on each of its running objects that implements IMarshal.
The outcome of any implementation of this method should be to enable a proxy to respond to all subsequent calls from its client by returning RPC_E_DISCONNECTED or CO_E_OBJNOTCONNECTED rather than attempting to forward the calls on to the original object. It is up to the client to destroy the proxy.
If you are implementing this method for an immutable object, such as a moniker, your implementation does not need to do anything because such objects are typically copied whole into the client's address space. Therefore, they have neither a proxy nor a connection to the original object. For more information on marshaling immutable objects, see the "When to Implement" section of the IMarshal topic.
|Minimum supported client||Windows 2000 Professional [desktop apps | UWP apps]|
|Minimum supported server||Windows 2000 Server [desktop apps | UWP apps]|
|Header||objidl.h (include ObjIdl.h)|