Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 4.38 KB

nn-objidlbase-iexternalconnection.md

File metadata and controls

81 lines (60 loc) · 4.38 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NN:objidlbase.IExternalConnection
IExternalConnection (objidlbase.h)
The IExternalConnection (objidlbase.h) interface manages a server object's count of marshaled, or external, connections.
IExternalConnection
IExternalConnection interface [COM]
IExternalConnection interface [COM]
described
_com_iexternalconnection
com.iexternalconnection
objidlbase/IExternalConnection
com\iexternalconnection.htm
com
28afc305-d5b0-4ac9-9412-5876e575c2c2
08/15/2022
IExternalConnection, IExternalConnection interface [COM], IExternalConnection interface [COM],described, _com_iexternalconnection, com.iexternalconnection, objidlbase/IExternalConnection
objidlbase.h
ObjIdl.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
ObjIdl.idl
Windows
19H1
IExternalConnection
objidlbase/IExternalConnection
c++
APIRef
kbSyntax
COM
objidlbase.h
IExternalConnection

IExternalConnection interface

-description

Manages a server object's count of marshaled, or external, connections. A server that maintains such a count can detect when it has no external connections and shut itself down in an orderly fashion.

-inheritance

The IExternalConnection interface inherits from the IUnknown interface. IExternalConnection also has these types of members:

-remarks

IExternalConnection is most commonly implemented on server objects, to enable the orderly shutdown of a link to an embedded object following a silent update. Objects that do not implement IExternalConnection risk losing data in such a situation: When the final link client releases the embedded (server) object, the last external connection on the object's stub manager is released, causing the stub manager to release its pointers to interfaces on the embedded object and initiate shutdown of the object. At this point, the server object calls IOleClientSite::SaveObject on the link container, and the link container's return call to IPersistStorage::Save fails because the stub manager no longer has a pointer to the embedded object. Any unsaved changes to the server object's data would then be lost.

If the server object implements IExternalConnection, however, its stub manager will not release its connection to the object when the last external connection is released. Instead, it will stay connected until the object is ready to destroy itself.

In standard marshaling, to increment the object's count of external connections, COM calls IExternalConnection::AddConnection on the object when the object is first marshaled. The stub manager calls the methods of IExternalConnection on the object as subsequent external connections are obtained and released. When the object's count of external connections goes to zero, the object can save its data and then revoke itself from the running object table and do whatever else is necessary to reduce its object reference count to zero.

An object that implements IExternalConnection should explicitly call CoDisconnectObject on itself when its external reference count drops to 0. This call will cause the stub manager to call Release on the object so that the object can destroy itself.

-see-also

CoDisconnectObject

CoLockObjectExternal

IOleObject