If you recall from Chapter 16, for our InventoryKeeper DLL to share information with the various clients (the Honda factory and dealerships), Windows Messaging was used for notification through a PostMessage() call. On reception of a notification from the DLL, a client, such as Dealer or Factory , would than make a function call back into the DLL to retrieve additional information.
With COM, we can do away with PostMessage() calls and client polling by setting up a server to inform clients of new information establishing an outgoing interface specifically called a dispinterface , which is short for dispatch interface. In a moment, we will see how a dispinterface can be implemented using the Type Library Editor.
For this to work, a client, not the server, will need to implement the outgoing interfaces established by the server. Specifically, the client will need an object that implements a dispinterface . Such an object is called an event sink .
In short, an event sink is a COM object on the client-side that implements an outgoing interface ( dispinterface ) associated to a COM object within a server. The client can then connect its event sink to the server through a connection point and start receiving events. The server fires events to the client through the methods of the sink object interface. Figure 17.15 illustrates how it works.
Top |