Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This method increments an object's count of its strong external connections (links).
Syntax
HRESULT AddConnection( DWORD exconn, DWORD dwreserved ); |
Parameters
- exconn
-
[in] 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 = 0x0001, which is defined in the enumeration EXTCONN.
- dwreserved
-
[in] Passes information about the connection.
This parameter is reserved for use by OLE. Its value can be zero, but not necessarily. Therefore, implementations of AddConnectionshould not contain blocks of code whose execution depends on whether a zero value is returned.
Return Value
- DWORD value
-
The number of reference counts on the object; used for debugging purposes only.
Remarks
An object created by a EXE object server relies on its stub manager to call IExternalConnection::AddConnectionwhenever 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::ReleaseConnectionto release the lock.
Because DLL object applications exist in the same process space as their objects, they do not use RPCs (remote procedure calls) and therefore do not have stub managers to keep track of external connections.
Therefore, DLL servers that support external links to their objects must implement IExternalConnectionso link clients can directly call the interface to inform them when connections are added or released.
The following is a typical implementation for the AddConnectionmethod.
Copy Code | |
---|---|
DWORD XX::AddConnection(DWORD extconn, DWORD dwReserved) { return extconn&EXTCONN_STRONG ? ++m_cStrong : 0; } |
To determine whether the platform supports this interface, see Determining Supported COM APIs.
Requirements
Header | objidl.h, objidl.idl |
Library | ole32.lib, uuid.lib |
Windows Embedded CE | Windows CE 3.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |