Skip to Main Content
Learning DCOM
book

Learning DCOM

by Thuan L. Thai
April 1999
Intermediate to advanced content levelIntermediate to advanced
502 pages
15h 5m
English
O'Reilly Media, Inc.
Content preview from Learning DCOM

Event Sinks

Now that you have the ChatServer component in place, you’ll build the ChatClient component. As shown earlier in Figure 10-2, this component implements a COM object that is an event sink that will receive all messages fired off by the event source object in the ChatServer component. Specifically, as soon as the ChatServer component receives a chat message, it sends the same message back to all connected ChatClients through the client’s event sink object, shown in Figure 10-2 as CoMsgSink. The CoMsgSink object supports a callback interface called IReceiveMessage that the ChatServer component can utilize to make callbacks. Recall that you’ve defined this interface earlier in the last section, but you haven’t implemented it. You’ll do that in this section.

Besides implementing an event sink in this section, you’ll see the special contribution of this chapter in the subsection on Joining and Leaving a Chat Discussion where you contact the ChatBroker to find a ChatServer. You get a handle to the ChatServer via an interface pointer. Remember that this interface pointer is passed from the ChatServer to the ChatBroker to the ChatClient in the form of an OBJREF, and an OBJREF is the key that opens up distributed computing.

Creating the ChatClient Project

Our goal in this section is to develop a client application that looks similar to the one shown in Figure 10-3. So let’s use the MFC AppWizard EXE to create a Dialog base application and name this project ChatClient.

Creating the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Windows Internals, Fifth Edition

Windows Internals, Fifth Edition

David A. Solomon Mark E. Russinovich and Alex Ionescu
Windows® via C/C++, 5th Edition

Windows® via C/C++, 5th Edition

Jeffrey Richter, Christophe Nasarre
Learning Go

Learning Go

Jon Bodner

Publisher Resources

ISBN: 9781449307011Supplemental ContentErrata Page