ConnectionPoint Events

ConnectionPoint events allow a COM object to receive events from SQL-DMO objects. ConnectionPoint point events are available only to C++ applications.

To implement the event methods of a SQL-DMO object named Object that supports ConnectionPoint events, a COM object (typically named ObjectSink) must follow these requirements:

    To use events of a SQL-DMO object named Object that supports ConnectionPoint events
  1. Call the IUnknown::QueryInterface method of the SQL-DMO object that supports ConnectionPoint events. Pass IID_IConnectionPointContainer as the riid parameter, and pass the address of a pointer to a ConnectionPointContainer object as the ppvObj parameter.

    QueryInterface will set ppvObj to point to a ConnectionPointContainer object.

  2. Call the IConnectionPointContainer::FindConnectionPoint method of the ConnectionPointContainer object. Pass the event sink interface ID of the SQL-DMO object as the first (xxx) parameter, and pass the address of a pointer to a ConnectionPoint object as the second (yyy) parameter.

    FindConnectionPoint will set yyy to point to a ConnectionPoint object.

  3. Create an ObjectSink object.
  4. Call the ISQLOLEObjectSink::Advise method of the ConnectionPoint object. Pass a pointer to the ObjectSink object as the pAdvSink parameter, and pass the address of a token as the pdwConnection parameter.

    Advise will set pdwConnection to an advisement identifier, or "cookie," that is used when calling ISQLOLEObjectSink::Unadvise.

  5. Use the SQL-DMO object. When a SQL-DMO event for that object is fired, SQL-DMO will call the appropriate event method of the ObjectSink object.
  6. Call the ISQLOLEObjectSink::Unadvise method of the ConnectionPoint object. Pass the "cookie" advisement identifier as the dwConnection parameter.

    SQL-DMO will no longer call the ObjectSink object when SQL-DMO events are fired.

  7. Call the IUnknown::Release method of the ConnectionPoint object.
  8. Call the IUnknown::Release method of the ConnectionPointContainer object.

The following table lists the SQL-DMO objects that support ConnectionPoint events and the event sink interfaces and interface IDs for each of them.


SQL-DMO
object
Event sink
interface
Event sink
interface ID

SQLServer ISQLOLEServerSink IID_ISQLOLEServerSink
Backup ISQLOLEBackupSink IID_ISQLOLEBackupSink
Transfer ISQLOLETransferSink IID_ISQLOLETransferSink
BulkCopy ISQLOLEBulkCopySink IID_ISQLOLEBulkCopySink

For more information about COM events, see the Microsoft OLE Control Developer's Kit and the Microsoft Win32 SDK.