Microsoft .NET is here, but COM and COM+ will be a valuable part of every Microsoft Windows® programmer’s toolbox for years. This in-depth programming guide explains how and where COM and COM+ fit into the new .NET world, demonstrates the new technologies that are available in .NET, and shows how to interoperate between COM/COM+ and .NET. It explains how to use Microsoft Visual Studio® .NET to write traditional COM objects, how to use COM objects in .NET code, and how to use .NET objects as COM objects. It also discusses COM+ topics such as disconnected applications and subscriptions. The authors show you both theoretical and practical approaches—explaining how the mechanisms work and also providing practical advice with sample code to show how to handle interoperability.
Topics covered include:
The .NET view of COM and COM+
COM, COM+, and .NET
Using COM components in .NET code
Using .NET components in COM applications
Overview of COM+ coding for .NET
Writing COM code
Attributed programming
Active Template Library (ATL) and ATL Server
Writing COM+ code
A simple COM+ example
Working with disconnected applications
Creating subscriptions
Web application scenarios
Interoperability
Interacting with unmanaged code
Advanced interaction
Working with predefined interfaces
Includes sample code on the Web
The .NET View of COM and COM+
Chapter 1 COM and .NET
Is COM Dead?
How Does COM Work in the .NET World?
Differences in the COM and .NET Philosophies
Using the IDE to Access Components
Summary
Chapter 2 COM+ and .NET
What Is the Place of COM+ in the .NET World?
COM+ Problems and Improvements
Using the Component Services MMC Snap-In
Using the .NET Framework Configuration MMC Console
Summary
Chapter 3 Using COM Components in .NET Code
COM Interop: Principles and Mechanisms
Generating Runtime Callable Wrappers
How COM Entities Are Converted
How to Design COM Components for Use with .NET
Responding to COM Events
Using ActiveX Controls with .NET
Summary
Chapter 4 Using .NET Components in COM Applications
The COM Callable Wrapper
Generating and Using COM Callable Wrappers
Exporting Metadata to Type Libraries
How to Design .NET Components for Use with COM
Hosting Windows Forms Controls in ActiveX Control Containers
Exposing .NET Events in COM
Summary
Chapter 5 An Overview of COM+ Coding for .NET
COM+ Begins with COM
Understanding the Role of DCOM in COM+
COM+-Specific Issues
Summary
Writing COM Code
Chapter 6 Attributed Programming
What Are Attributes?
Using Attributes in C++ Code
Walkthrough: Creating a Simple COM Component
Basic Attributed Programming
Handling Aggregation
Handling Errors
Events
Compiler Options
Summary
Chapter 7 ATL and ATL Server
Changes in ATL 7.0
Introduction to ATL Server
ATL Server Architecture
Writing Web Applications Using ATL Server
Writing Web Services Using ATL Server
Consuming Web Services in C++
Summary
Writing COM+ Code
Chapter 8 A Simple COM+ Example
The Importance of Using GUIDs
A Simple Component Example
A ServicedComponent Class Example
Summary
Chapter 9 Working with Disconnected Applications
Understanding the Role of MSMQ in this Application
Creating a Simple Recorder/Player
Creating a Simple COM+ Listener/Player
Creating the MSMQ Client Application
Summary
Chapter 10 Creating Subscriptions
An Overview of the COM+ Catalog
What Are Subscriptions?
Creating the Event Object
Creating the Publisher
Creating a Component Subscriber
Creating a Dialog-Based Subscriber
Summary
Chapter 11 Web Application Scenarios
How Do Web-Based Applications Differ?
Defining the Database
Creating the Data Access Component
Using ASP to Access the Database
Testing the Application
Summary
Interoperability
Chapter 12 Interacting with Unmanaged Code
Managed and Unmanaged Code
Platform Invoke
Visual C# Concerns
Visual C++ Concerns
Summary
Chapter 13 Advanced Interaction
The MarshalAs Attribute
Marshaling Strings
Marshaling Structs
Marshaling Arrays
Passing Managed Pointers to Unmanaged Code
Dynamically Loading Platform Invoke DLLs
Using Callbacks
Garbage Collection Considerations
Performance Considerations
Summary
Chapter 14 Working with Predefined Interfaces
COM Requires Specific Interfaces
Using the OLE/COM Object Viewer
Re-creating COM Interfaces Using Managed Code
Creating a Component with Specialized Interfaces Example
John Paul Mueller is a freelance author and a technical editor. He has writing in his blood, having produced 49 books and more than 200 articles to date. The topics range from networking to aritficial intelligence and from database management to heads-down programming. His current books include a COM+ programmer's guide and a book designed to help with home and small office networking. His technical editing skills have helped more than 25 authors refine the content of their manuscripts, some of which are certification related. In addition to book projects, John has provided technical editing services to both Data Based Advisor and Coast Compute magazines. A recognized authority on computer industry certifications, he's also contributed certification-related articles to magazines such as Visual Basic® Developer and SQL Server® Professional.
As a professional consultant, trainer, and writer, Julian Templeman has been involved in using, teaching, and writing about COM for five years. He's taught COM courses to hundreds of students throughout the United Kingdom and Europe, and as a result he knows how to explain complex COM issues to programmers. As a consultant, he's advised large and small companies on COM technology, and he has a firm grasp of the practicalities involved in the everyday use of COM in Windows-based software development.
Julian has also been sole or joint author of 10 programming books, so he has expertise in explaining programming topics in writing. Two of these books concerned COM: the first was the only detailed book on using COM with the Microsoft MFC library, and the second was the best-selling Beginning ATL COM Programming from Wrox Press. Julian's most recent book, published through Microsoft Press®, is Microsoft Visual C++® .NET Step by Step.
On the .NET side, Julian has been using .NET since the first alpha version was handed out at the Denver Professional Developers' Conference in 1998. At the time of writing (April 2002), he has contributed to three .NET books on the market, and he has an in-depth knowledge of the .NET technologies at both overview and detailed levels. In addition, he has recently coauthored Microsoft Official Curriculum course 2558 on writing .NET code using Visual C++ .NET. Julian is also currently running .NET programming courses and doing a small (but increasing) amount of .NET consultancy work.