.NET and COM: The Complete Interoperability Guide

Overview

<> The focus of the book is on COM Interoperability (since it's a much larger subject), and the heart of the discussion is broken down into four parts:
  • Using COM Components Within the .NET Framework
  • Using .NET Framework Components from COM
  • Designing Good .NET Framework Components for COM Clients
  • Designing Good COM Components for .NET Framework Clients

The scope of the...

See more details below
Paperback
$42.78
BN.com price
(Save 34%)$64.99 List Price
Other sellers (Paperback)
  • All (6) from $7.14   
  • New (2) from $41.81   
  • Used (4) from $7.14   
.NET and COM: The Complete Interoperability Guide

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac

Want a NOOK? Explore Now

NOOK Book (eBook)
$29.99
BN.com price
(Save 42%)$51.99 List Price

Overview

<> The focus of the book is on COM Interoperability (since it's a much larger subject), and the heart of the discussion is broken down into four parts:
  • Using COM Components Within the .NET Framework
  • Using .NET Framework Components from COM
  • Designing Good .NET Framework Components for COM Clients
  • Designing Good COM Components for .NET Framework Clients

The scope of the book is just about everything related to using "unmanaged code" in the .NET Framework. Technologies built on top of COM Interoperability are also covered-Interoperability of Windows Forms Controls and ActiveX controls, Interoperability with COM+, and Interoperability with Distributed COM (DCOM). Although Platform Invocation Services is a separate technology from COM Interoperability, there are many areas of overlap, so including in the book is a natural fit. All of these technologies are a core part of the Common Language Runtime and .NET Framework, and will likely be used not only as the path of migration for existing software projects, but for brand new software development for the next several years.

This product consists of of two volume set.

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
Companies have spent a decade investing in custom Windows development. .NET developers can't afford to throw that code away. But most books dispose of .NET's interoperability features in just a chapter or two. Finally, though, there's an exhaustive, code-rich guide to .NET legacy interoperability.

At Microsoft, author Adam Nathan was extensively involved in testing .NET's COM Interoperability features. He knows them backward and forward -- including the rough spots.

Nathan begins by concisely explaining the interactions between managed .NET code and "unmanaged" legacy code, and how .NET enables the use of old code while potentially ameliorating some of its problems (e.g., security).

You'll walk through using COM objects and ActiveX controls in ASP.NET pages; marshaling data across unmanaged/managed boundaries; and much more. (The first case study: building a .NET application that uses Word's spellchecker.) There are extensive chapters on imported assemblies, responding to COM events, creating and modifying Interop assemblies; and working with exported type libraries.

Microsoft's official .NET design guidelines do a great job of promoting consistency, predictability, and ease-of-use in the context of .NET languages. But some of those guidelines prevent COM clients from fully utilizing your new code. Nathan shows how to design great .NET software that doesn't straitjacket COM clients.

If most .NET books gloss over COM Interoperability, they do even worse with PInvoke, which lets you access functionality exposed by static entry points instead of COM components. Nathan offers a full section on PInvoke. He also covers three advanced topics in exceptional detail: custom marshaling, manually defining COM types in source code; and directly accessing .NET's interoperability APIs without using the intermediary tools Microsoft provides.

Legacy interoperability with .NET isn't simple, but it is crucial. This book is an unprecedented resource for working developers who need to make it happen. (Bill Camarda)

Bill Camarda is a consultant, writer, and web/multimedia content developer with nearly 20 years' experience in helping technology companies deploy and market advanced software, computing, and networking products and services. He served for nearly ten years as vice president of a New Jersey–based marketing company, where he supervised a wide range of graphics and web design projects. His 15 books include Special Edition Using Word 2000 and Upgrading & Fixing Networks For Dummies®, Second Edition.

Read More Show Less

Product Details

  • ISBN-13: 9780672321702
  • Publisher: Sams
  • Publication date: 2/1/1902
  • Series: Sams White Book Series
  • Pages: 1608
  • Product dimensions: 7.40 (w) x 9.20 (h) x 3.30 (d)

Meet the Author

Adam Nathan is a software design engineer on Microsoft's .NET Common Language Runtime QA team. Taking on the role of an external software developer, Adam has worked to ensure the quality and usability of COM Interoperability for close to three years. He has participated in the design decisions that have shaped the product from its beginnings, and thus is able to give a unique perspective when explaining this complex technology to the reader. Adam is a co-author of ASP.NET: Tips, Tutorial, and Code.

Adam has server on a panel of .NET experts, provided technical assistance during hands-on labs, and helped to prepare deonstrations at the Microsoft Professional Developers Conferences in 2000 and 2001. He has learned where developers of aqll skill levels frequently struggle with COM Interoperability and Platform Invocation Services, and regularly provides technical assistance on .NET mailing lists. Adam received an honors B.S. degree in computer science at Cornell University in Ithaca, New York.

Read More Show Less

Table of Contents

(NOTE: Each chapter concludes with a Conclusion.)

Introduction.

I. BACKGROUND.

1. Introduction to the .NET Framework.

What Is .NET? Features of the .NET Framework. Concepts Important for This Book. Languages and Tools.

2. Bridging the Two Worlds-Managed and Unmanaged Code.

Managed Code Versus Unmanaged Code. How Unmanaged Code Interacts with Managed Code. Unmanaged Code Isn't Always the Answer.

II. USING COMCOMPONENTS IN .NETAPPLICATIONS.

3. The Essentials for Using COM in Managed Code.

Referencing a COM Component in Visual Studio .NET. Referencing a COM Component Using Only the .NET Framework SDK. Example: A Spoken Hello, World Using the Microsoft Speech API. The Type Library Importer. Using COM Objects in ASP.NET Pages. An Introduction to Interop Marshaling. Common Interactions with COM Objects. Using ActiveX Controls in .NET Applications. Deploying a .NET Application That Uses COM. Example: Using Microsoft Word to Check Spelling.

4. An In-Depth Look at Imported Assemblies.

Converting the Library. Converting COM Data Types. Converting Methods and Properties. Converting Interfaces. Converting Classes. Converting Modules. Converting Structures. Converting Unions. Converting Enumerations. Converting Typedefs. Converting ActiveX Controls.

5. Responding to COM Events.

Callbacks in .NET. Callbacks in COM. Handling COM Events in Managed Code. Handling ActiveX Control Events in Managed Code.

6. Advanced Topics for Using COM Components.

Do-It-Yourself Marshaling. Threading and Apartments. Troubleshooting an InvalidCastException. Garbage Collection. Securing Unmanaged Calls. Using COM+ and DCOM Objects. Inheriting from COM Classes. Debugging into COM Components. Monitoring Performance.

7. Modifying Interop Assemblies.

How to Change an Assembly's Contents. IL Assembler Syntax. Changing Data Types. Exposing Success HRESULTs. Arrays. Custom Attributes. Adding Methods to Modules.

III. USING .NETCOMPONENTS IN COMAPPLICATIONS.

8. The Essentials for Using .NET Components from COM.

A Sample .NET Component. Using a .NET Component in Visual Basic 6. Using a .NET Component in Unmanaged Visual C++. Using a .NET Component in Unmanaged JScript. Assembly Registration. The Type Library Exporter. .NET Class Interfaces. Interacting with a .NET Object. Deploying a COM Application That Uses .NET. Hosting Windows Forms Controls in Internet Explorer.

9. An In-Depth Look at Exported Type Libraries.

Converting the Assembly. Converting .NET Data Types. Converting Members. Converting Interfaces. Converting Classes. Converting Value Types. Converting Enumerations.

10. Advanced Topics for Using .NET Components.

Avoiding Registration. Hosting Windows Forms Controls in Any ActiveX Container. Working Around COM-Invisibility. Using Reflection to Invoke Static Members. Handling .NET Events. Unexpected Casing in Type Libraries. Advanced Shutdown Topics.

IV. DESIGNING GREAT .NETCOMPONENTS FOR COMCLIENTS.

11. .NET Design Guidelines for Components Used by COM Clients.

Naming Guidelines. Usage Guidelines. Reporting Errors. Exposing Enumerators to COM. Versioning. Deployment. Testing Your Component from COM.

12. Customizing COM's View of .NET Components.

Customizing Data Types. Customizing Structure Layout. Exposing Class Interfaces. Using Visual Basic .NET's ComClassAttribute. Making APIs Invisible to COM. Customizing Registration. Providing Your Own GUIDs. Providing Your Own DISPIDs. Controlling Interface Derivation. Returning a Specific HRESULT. Disabling Type Library Marshaling of .NET Interfaces. Creating Multi-Cultured Methods. Using Optional Parameters in Any Language. Exposing .NET Objects As COM+ Objects.

13. Exposing .NETEvents to COM Clients.

Exposing Events Without Using Extra CLR Support. Exposing Events Using Extra CLR Support. Example: Handling a .NET Windows Form's Events from COM.

14. Implementing COM Interfaces for Binary Compatibility.

Getting Interface Definitions. Binary Compatibility with Visual Basic 6 Classes. Example: Implementing Office XP Smart Tag Interfaces. Interface Implementation Shortcuts in Visual Studio .NET. Common Problems When Implementing COM Interfaces. COM Interfaces with Default CCW Implementations. COM Interfaces Bridged to Different .NET Types.

V. DESIGNING GREAT COMCOMPONENTS FOR .NETCLIENTS.

15. Creating and Deploying Useful Primary Interop Assemblies.

Primary Interop Assembly or Brand New Assembly? Creating a Primary Interop Assembly. Deploying and Registering a Primary Interop Assembly. Writing IDL That Produces Good Type Libraries. What About ActiveX Controls?

16. COM Design Guidelines for Components Used by .NET Clients.

General Guidelines. Using Array Parameters. Issues with VARIANT Parameters. Reporting Errors. Adjusting Certain COM-Specific Idioms. Managing Limited Resources. Threading and Apartment Guidelines. Providing Self-Describing Type Information. Naming Guidelines. Performance Considerations.

17. Implementing .NET Interfaces for Type Compatibility.

Class Interfaces. Interface Inheritance. Considerations for Visual C++ Programmers. Considerations for Visual Basic 6 Programmers.

VI. PLATFORM INVOCATION SERVICES (PINVOKE).

18. The Essentials of PInvoke.

Using PInvoke in Visual Basic .NET. Using PInvoke in Other .NET Languages. Choosing the Right Parameter Types. Customizing Declare and DllImportAttribute.

19. Deeper Into PInvoke and Useful Examples.

Callbacks. Passing Structures. Handling Variable-Length Structures and Signatures. Using C# Unsafe Code. Guarding Against Premature Garbage Collection. Choosing the DLL Location or Name Dynamically. Example: Responding Immediately to Console Input. Example: Clearing the Console Screen. Example: Using CoCreateInstanceEx to Activate Remote COM Objects.

VII. ADVANCED TOPICS.

20. Custom Marshaling.

Transforming Types Without Custom Marshaling. Custom Marshaling Architecture. Marshalers, Marshalers, Marshalers! Limitations.

21. Manually Defining COM Types in Source Code.

Using SDK Tools for Support. Manually Defining COM Interfaces. Manually Defining Coclass Interfaces and Event Types. Manually Defining COM Structures. Manually Defining COM Enums. Manually Defining COM Classes. Avoiding the Balloon Effect.

22. Using APIs Instead of SDK Tools.

Generating an Assembly from a Type Library. Generating a Type Library from an Assembly. Registering and Unregistering Assemblies. Installing and Uninstalling Serviced Components. Example: Using the APIs in an Interactive Application.

VIII. COMPREHENSIVE EXAMPLES.

23. Writing a .NET Arcade Game Using DirectX.

The User's Perspective. The Programmer's Perspective. DirectX Interaction. The Game Class. Sounds and Pictures. Layers. Screens. The Actors. Using the Game Class. E-mail Attack-The Advanced Version.

24. Writing .NET Visualizations For Windows Media Player.

The COM Visualization API. Creating a .NET Visualization API. Using the .NET Visualization API.

IX. APPENDICES.

Appendix A. System.Runtime.InteropServices Reference.

The System.Runtime.InteropServices Namespace. The System.Runtime.InteropServices.CustomMarshalers Namespace. The System.Runtime.InteropServices.Expando Namespace.

Appendix B. SDK Tools Reference.

TLBIMP.EXE. TLBEXP.EXE. REGASM.EXE. AXIMP.EXE. REGSVCS.EXE.

Appendix C. HRESULT to .NET Exception Transformations.

Appendix D. .NET Exception to HRESULT Transformations.

Appendix E. PInvoke Definitions for Win32 Functions.

GDI32.DLL. KERNEL32.DLL. OLE32.DLL. SHELL32.DLL. USER32.DLL.

Appendix F. Glossary.

Index.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)