I’ve designed this book so that each chapter assumes knowledge from the previous one. This allows you to read the book from beginning to end, limiting the need for jumping here and there among chapters. To give you a heads up, here are brief summaries for the chapters and appendices covered in this book.
Chapter 1, takes a brief look at the progress of distributed computing. While it describes several popular distributed computing technologies, its real purpose is to point out that the communications layer becomes more advanced as time progresses. It is this advancement that gives birth to technologies such as RPC and Distributed COM.
Chapter 2, provides a high-level introduction to COM and the motivation of this ubiquitous technology. This chapter also provides a general examination of the important facilities and services that a typical distributed object technology should support. It uses the COM terminology that prepares you to take on the rest of the chapters in this book.
Chapter 3, gets down to the nuts and bolts of COM. This chapter teaches you the fundamental elements and requirements for building a distributed object using pure C++. Since COM enforces the separation of interface from implementation, I first take you on a tour of interface definition and then show you how to implement the specified interfaces. Along the way, you’ll learn the Microsoft Interface Definition Language (MIDL), MIDL data types, error handling, the binary layout of a COM interface, and factories. By the time you finish reading this chapter, you will learn the fundamentals of writing a COM object using C++.
Chapter 4, is a follow-up to Chapter 3. The COM objects developed using the techniques described in Chapter 3 cannot execute alone—they require a hosting binary module, such as a DLL or an EXE. In this book, we call these binary modules components. This chapter shows you how to wrap a number of COM classes (whose instances are called COM objects) into a server component. You’ll also learn how to develop a client component that uses the services exposed by a server component.
Chapter 5, expands your understanding of COM. The knowledge gained in Chapter 3 and Chapter 4 are enough to build and use distributed components, but they’re not enough to build real distributed systems that take memory, threading, and security management into account. This chapter continues Chapter 4 by filling the memory, threading, and security management gaps. You’ll learn what the COM infrastructure does and why it does what it does. By the time you finish this chapter, you will know the fundaments necessary to build distributed systems using COM.
Chapter 6, examines the Active Template Library (ATL), which makes developing components much easier. After reading Chapter 3 through Chapter 5, you will realize that most of the code developed in Chapter 3 and Chapter 4 is boilerplate code. In fact, you can write template classes and macros to hide the boilerplate code, so that it will take less code to write a component. This is exactly what ATL does. It is a set of C++ template classes and macros that hides the boilerplate code. By using these classes and macros, you reduce the amount of code that you must write to build a distributed component.
Chapter 7, presents several ways to use a distributed COM object. In this chapter, you will learn four different techniques for using a COM object developed by someone else. Some of these techniques are easier to use than others, but you should know them all. This knowledge will allow you to choose an appropriate technique when using a COM object.
Chapter 8, shows you how to build ActiveX controls that can be embedded into a container application, such as Internet Explorer. You’ll build an ActiveX control without a complex user interface and two other ones with a complex user interface. Since you can put these ActiveX controls into a web page, you will also develop the web pages that can host them. In addition, you’ll learn how to expose your COM object’s properties through the use of property pages.
Chapter 9, elevates your understanding of Chapter 5. You’ll build a server component that takes advantage of the access token, server-side COM security, Windows NT security, auditing, and administrative alerts. You’ll also build a client component that takes advantage of client-side COM security, which includes specifying the process-wide security, choosing an identity that is used for launching distributed components, and using call-level security.
Chapter 10, reminds you that the main importance of Distributed COM is that it allows a pointer to be passed from one machine to a second, from the second to a third, and so on. This notion is the key that opens the doors into the world of distributed objects computing. It also allows two objects to pass interface pointers between themselves to achieve bi-directional communications. To grasp this notion, you’ll build a simple chat system that includes a chat broker, server, and client.
Appendix A, describes three simple, but very powerful, techniques for debugging distributed components. Learn these techniques because they can be very valuable.
Appendix B, exhibits the performance data for in-process, local, and remote method invocations. This appendix also shows the drastic performance differences among different threading models for in-process COM objects.
Appendix C, introduces you to the new features of COM in Windows NT 4.0 Service Pack 4 and above. This appendix also includes a brief discussion of COM+, which will be released with Windows 2000.
Appendix D, serves as a supplement to help you understand the source code located within the Hello directory. This appendix is for those who want to get a sneak preview at the kind of code that must be written in order to develop simple distributed components using COM. Again, I provide this appendix solely as a supplement, so you must read the whole book to really build distributed systems using COM.