Skip to content

Latest commit

 

History

History
97 lines (70 loc) · 4.15 KB

nf-objidl-iexternalconnection-addconnection.md

File metadata and controls

97 lines (70 loc) · 4.15 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
NF:objidl.IExternalConnection.AddConnection
IExternalConnection::AddConnection (objidl.h)
The IExternalConnection::AddConnection method (objidl.h) increments the count of an object's strong external connections.
AddConnection
AddConnection method [COM]
AddConnection method [COM]
IExternalConnection interface
IExternalConnection interface [COM]
AddConnection method
IExternalConnection.AddConnection
IExternalConnection::AddConnection
_com_iexternalconnection_addconnection
com.iexternalconnection_addconnection
objidlbase/IExternalConnection::AddConnection
com\iexternalconnection_addconnection.htm
com
7439cb16-1da3-4fab-a16d-519f9ce1053a
08/12/2022
AddConnection, AddConnection method [COM], AddConnection method [COM],IExternalConnection interface, IExternalConnection interface [COM],AddConnection method, IExternalConnection.AddConnection, IExternalConnection::AddConnection, _com_iexternalconnection_addconnection, com.iexternalconnection_addconnection, objidlbase/IExternalConnection::AddConnection
objidl.h
ObjIdl.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
ObjIdl.idl
Windows
19H1
IExternalConnection::AddConnection
objidl/IExternalConnection::AddConnection
c++
APIRef
kbSyntax
COM
objidlbase.h
IExternalConnection.AddConnection

IExternalConnection::AddConnection

-description

Increments the count of an object's strong external connections.

-parameters

-param extconn [in]

The type of external connection to the object. The only type of external connection currently supported by this interface is strong, which means that the object must remain alive as long as this external connection exists. Strong external connections are represented by the value EXTCONN_STRONG, which is defined in the enumeration EXTCONN.

-param reserved [in]

Information about the connection. This parameter is reserved for use by OLE. Its value can be zero, but not necessarily. Therefore, implementations of AddConnection should not contain blocks of code whose execution depends on whether a zero value is returned.

-returns

The method returns the count of connections. This value is intended to be used only for debugging purposes.

-remarks

An object created by a EXE object server relies on its stub manager to call AddConnection whenever a link client activates and therefore creates an external lock on the object. When the link client breaks the connection, the stub manager calls IExternalConnection::ReleaseConnection to release the lock.

DLL object applications exist in the same process space as their objects, so they do not use RPC (remote procedure calls) and do not have stub managers to keep track of external connections. Therefore, DLL servers that support external links to their objects must implement IExternalConnection so that link clients can directly call the interface to inform them when connections are added or released.

The following is a typical implementation for the AddConnection method.

DWORD MyInterface::AddConnection(DWORD extconn, DWORD dwReserved)
{
    return extconn & EXTCONN_STRONG ? ++m_cStrong : 0;
}

-see-also

IExternalConnection

IRunnableObject::LockRunning

OleLockRunning