TY - BOOK AU - Troelsen,Andrew TI - COM and .NET interoperability T2 - . Net developer series SN - 9781590590119 (pbk.) : AV - QA76.6 U1 - 005.268 TRO 21 PY - 2002/// CY - San Francisco, Calif. PB - Apress KW - Microsoft .NET Framework KW - Object-oriented programming (Computer science) KW - Computer software KW - Development KW - COM (Computer architecture) KW - Computer programming KW - Computers and IT KW - ukslc KW - Microsoft programming KW - thema KW - Software Engineering KW - Programming & scripting languages: general KW - Computer architecture & logic design N1 - Includes index; Chapter 1; Understanding Platform Invocation Services; 1 --; The Two Faces of Unmanaged Code; 1 --; Understanding the C-Style DLL; 2 --; Building a Custom C-Based DLL; 5 --; Viewing Your Imports and Exports Using dumpbin. exe; 9 --; Deploying Traditional DLLs; 12 --; A Dynamic C++ DLL Client; 15 --; The Atoms of PInvoke; 18 --; A Trivial PInvoke Example; 26 --; Interacting with MyCustomDLL.d11; 33 --; Working with Unmanaged Callbacks; 42 --; A Simple Callback Example; 43 --; A More Interesting Callback Function; 44 --; Building a C? Callback Client; 46 --; Chapter 2; The Anatomy of a COM Server; 51 --; Of Classes and Interfaces; 51 --; The Composition of a COM DLL; 63 --; The Role of Type Libraries; 65 --; The Role of the System Registry; 66 --; Creating the COM DLL Project Workspace; 67 --; Understanding COM Interfaces; 68 --; A Brief Word on COM-Centric Macros; 79 --; Implementing the ComCar; 80 --; Understanding IClassFactory; 84 --; Building Your Class Factory; 85 --; Implementing DLL Component Housing; 88 --; Exporting the Exports; 90 --; Registering the COM Server; 91 --; Developing a C++ COM Client; 97 --; Understanding COM Properties; 105 --; Building Scriptable Objects (Using IDispatch); 108 --; The VARIANT Data Type; 112 --; A C++ IDispatch Example; 116 --; A Visual Basic IDispatch Client; 117 --; Understanding the Dual Interface; 118 --; Defining a Scriptable Object; 118 --; Building the Class Factory; 123 --; Updating DllGetClassObject; 123 --; Updating the Server's Registration File; 124 --; Building a VBScript Late-Bound Client; 124 --; Chapter 3; A Primer on COM Programming Frameworks; 127 --; The Role of the Active Template Library; 127 --; The Role of Visual Basic 6.0; 146 --; Chapter 4; COM Type Information; 161 --; The Format of a COM IDL File; 162 --; Defining COM Types; 163 --; Primitive COM Data Types; 164 --; IDL Method Parameter Attributes; 167 --; Defining COM Interface Types in IDL; 171 --; The ITypeInfo Interface; 185 --; Generating COM Type Information Programmatically; 189 --; Building the Type Library (ICreateTypeLib); 191 --; Creating the IHello Interface; 193 --; Building the SayHello() Method; 198 --; Building the Hello Coclass; 200 --; Testing the Application; 201 --; Programmatically Reading COM Type Information; 203 --; Defining Custom IDL Attributes; 212 --; Introducing the System. Runtime. InteropServices Namespace; 218 --; Building a C? COM Type Information Viewer; 220 --; Chapter 5; The Anatomy of a .NET Server; 229 --; The Philosophy of .NET; 230 --; The Building Blocks of .NET; 231 --; Working with Managed Languages; 232 --; The Composition of a .NET Binary; 233 --; Building a C? Code Library; 235 --; Introducing ILDasm.exe; 243 --; Building a Managed Client; 250 --; Specifying Arbitrary Assembly Locations; 253 --; Understanding the Shared Assembly; 254 --; Using the Shared Assembly; 262 --; Versioning Shared Assemblies; 264 --; Working with Publisher Policy Assemblies; 267 --; And Now for Something Completely Different: System. CodeDOM; 270 --; Introducing the System. CodeDOM Namespace; 272 --; Compiling the Assembly; 284 --; Chapter 6; .NET Types; 289 --; The Role of System. Object; 289 --; Examining the .NET Data Type System; 294 --; The Set of Custom .NET Types; 297 --; Building a Complex Code Library; 302 --; Understanding Reflection; 304 --; Working with System. Type; 304 --; The System. Reflection Namespace; 309 --; Dynamically Loading an Assembly; 310 --; Building a Custom .NET Type Viewer; 312 --; A Brief Word Regarding System. Reflection. Emit; 323 --; Understanding .NET Attributes; 323 --; Creating and Applying Custom Attributes; 325 --; Reading Attributes at Runtime; 330 --; Binding Late to Shared Assemblies; 335 --; Chapter 7; .NET-to-COM Interoperability -- The Basics; 339 --; A High-Level Overview of .NET-to-COM Interoperability; 339 --; Building an Interop Assembly -- The Simplest Possible Example; 342 --; Converting Between COM IDL Data Types and Managed Data Types; 346 --; Interfaces Consumed by the RCW; 351 --; Options to Obtain an Interop Assembly; 353 --; Examining the Generated .NET Types; 356 --; Select Members of the System. Runtime. InteropServices Namespace; 362 --; COM Library Statement to .NET Assembly Statement Conversion Rules; 367 --; COM Types to .NET Types Conversion Rules; 371 --; Deploying Interop Assemblies; 392 --; Creating a Primary Interop Assembly; 393 --; Reflecting on Interop Assembly Attributes; 396 --; Interacting with Well-known COM Servers; 399 --; Chapter 8; .NET-to-COM Interoperability -- Intermediate Topics; 403 --; Handling the COM VARIANT; 403 --; Building a VARIANT-Centric COM Server; 405 --; Handling COM SafeArrays; 410 --; Handling C-Style Arrays; 419 --; Handling COM Param Arrays; 420 --; Handling COM Structures; 421 --; Handling COM Collections; 426 --; A Brief Review of COM Connection Points (COM Events); 437 --; Building a Connectable COM Type; 441 --; A Brief Review of .NET Delegates; 443 --; A Brief Review of .NET Events; 445 --; Examining the Interop Assembly; 448 --; Handling COM Error Objects; 459 --; The .NET Error Handling Mechanism; 464 --; Debugging COM Servers Using VS .NET; 468 --; Chapter 9; .NET-to-COM Interoperability -- Advanced Topics; 471 --; Revisiting the Marshal Class; 471 --; COM Coclasses Implementing .NET Interfaces; 475 --; Guidelines for Building .NET Type Compatible COM Classes; 484 --; Consuming ActiveX Controls from Managed Code; 490 --; Options for Consuming ActiveX Controls from Managed Code; 495 --; Modifying the Code for the AxHost-Derived Type; 504 --; Manually Modifying Interop Assemblies; 508 --; Understanding the Interop Editing Process; 510 --; Dissecting the Layout of Attribute Metadata; 517 --; Building a "Scratch" Assembly; 519 --; Building the Managed Client; 526 --; Building a Custom Type Library Importer Utility; 528 --; Building the Main Shell; 530 --; Chapter 10; COM-to-.NET Interoperability -- The Basics; 539 --; The Role of the CCW; 539 --; Core Requirements for COM-to-.NET Communications; 544 --; Using the tlbexp.exe Utility; 546 --; General Guidelines for Building COM-Aware .NET Types; 547 --; Critical .NET-to-COM Conversion Details; 554 --; Understanding the Class Interface; 557 --; Understanding the Object Interface; 562 --; The Case Against Class Interfaces; 563 --; Exposing Custom .NET Interfaces to COM; 564 --; Implementing Explicit Interfaces; 567 --; Controlling the Generated ProgID; 567 --; Controlling the COM Library Definition; 568 --; Handling Overloaded Methods; 569 --; Importing mscorlib.tlb; 570 --; Using the regasm.exe Utility; 572 --; Examining the Updated Entries; 574 --; Deploying the .NET Assembly; 582 --; Leveraging the Visual Studio .NET IDE; 584 --; Building a Visual Basic 6.0 COM Client; 584 --; Building a C++ COM Client; 589 --; Building a VBScript COM Client; 590 --; Chapter 11; COM-to-.NET Interoperability -- Intermediate Topics; 593 --; Converting .NET Enums to COM Enums; 593 --; Converting .NET Structures to COM Structures; 598 --; Converting .NET Delegates to COM Connection Points; 604 --; Building a .NET Event Server Using VB .NET; 608 --; Building a Visual Basic 6.0 Event Client; 609 --; Building a C++ Event Client; 610 --; Exposing Custom .NET Collections; 614 --; Exposing .NET Exceptions; 619 --; Exercising Your DotNetCollection Assembly from C++; 621 --; Converting .NET Interface with Multiple Base Interfaces; 624 --; Converting .NET Interface Hierarchies; 627 --; Chapter 12; COM-to-.NET Interoperability -- Advanced Topics; 633 --; Changing Type Marshaling Using MarshalAsAttribute; 633 --; .NET Types Implementing COM Interfaces; 638 --; Defining Custom COM Interfaces; 638 --; Building a VB 6.0 COM Client; 644 --; Defining COM Interfaces Using Managed Code; 646 --; Manually Defining COM Atoms: An Extended Example; 650 --; Interacting with Interop Assembly Registration; 653 --; Programmatically Converting Assemblies to COM Type Information; 655 --; Hosting the .NET Runtime from an Unmanaged Environment; 660 --; Chapter 13; Building Serviced Components (COM+ Interop); 669 --; The MTS, COM+, Component Services Name Game; 669 --; Recapping Component Services; 670 --; Reviewing the COM+ Runtime Environment; 672 --; The Role of the COM+ Catalog; 675 --; The Component Service Explorer; 678 --; A Classic COM+ Example; 682 --; Building a VB 6.0 COM+ Client; 683 --; Deploying COM+ Applications; 685 --; The System. EnterpriseServices Namespace; 687 --; Using the regsvcs.exe Command Line Utility; 694 --; Accessing the Configured .NET Component from VB 6.0; 698 --; Accessing the Configured .NET Component from C?; 699 --; Enabling Component Statistics; 699 --; A Brief Word on Lazy (Automatic) Registration; 700 --; Working with the RegistrationHelper Type; 701 --; Configuring a Managed COM+ Application Using .NET Attributes; 703 --; Supporting Object Construction Strings; 704 --; Examining the ContextUtil Type; 706 --; Understanding JITA; 708 --; JITA, IObjectControl, and the .NET Garbage Collector; 714 --; Configuring Poolable Objects; 715 --; A Recap of Transactional Programming; 717 --; Programming COM+ Transactions; 720 --; A Complete Serviced Component Example; 724 N2 - Andrew Troelsen explains the process of building .NET applications that are capable of interacting with existing COM code. The author provides a complete overview of COM architecture and its interaction with the Windows API ER -