Chapter 2 -- The Component Object Model

[Previous] [Next]

Chapter 2

You're reading this book because you've decided to learn about the Microsoft Active Template Library (ATL). Maybe your project is headed in that direction. Perhaps you've heard the acronym and have decided that ATL is the next technology in which to bury yourself. Or maybe you just want to make sure you and your development team are buzzword-compliant. Whatever your reason, before you perch yourself in front of this or any other ATL book to learn how to work with the framework, you need to be sure that you understand exactly how the Microsoft Component Object Model (COM) works.

Developers sometimes misconstrue the purpose of ATL and hope that it will save them from having to learn COM. Nothing could be further from the truth. It's true that once you learn the core concepts of COM, ATL will save you from a lot of typing while letting you retain control over the COM classes you write. Under the hood, however, ATL is just another way to wire COM interfaces to their implementations. You can get by just pumping out COM classes using the ATL COM Object Wizard and adding interface methods and attributes using the ClassView pane. But you'll be able to go only so far before you start bumping into the important hardcore issues related to COM. For example, you'll need to understand the importance of separating implementations from their interfaces. And if you avoid working through the issue of COM apartments, you won't be able to work effectively with the different threading models in COM (and don't even think of touching the Free Threaded Marshaler check box in the ATL Object Wizard property page).

In this chapter, we'll explore Microsoft's binary object model (COM and Distributed COM, or DCOM), looking at the fundamental concepts behind the technology and examining how COM works in a distributed environment. Our focus is on how COM and DCOM work with Microsoft Windows NT 4.0. In Microsoft Windows 2000, some things change—we'll talk about those changes in Chapter 17. We'll go over COM interfaces, COM classes, class objects, and apartments. We'll cover COM from the C++ perspective because that's the only way to really understand how COM works. To begin, we'll take a look at why COM exists in the first place and then work through each of COM's atoms.

Inside Atl
Inside ATL (Programming Languages/C)
ISBN: 1572318589
EAN: 2147483647
Year: 1998
Pages: 127 © 2008-2017.
If you may any questions please contact us: