"Mario Hewardt's<i>Advanced .NET Debugging</i>is an excellent resource for both beginner and experienced developers working with .NET. The book is also packed with many debugging tips and discussions of CLR internals, which will benefit developers architecting software."<i>-Jeffrey Richter, consulta
NET and COM the complete interoperability guide. - Description based on print version record. - Includes index
β Scribed by Nathan, Adam
- Publisher
- Sams Publishing
- Year
- 2002
- Tongue
- English
- Leaves
- 1610
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Synopsis
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.
β¦ Table of Contents
Cover......Page 1
Contents......Page 7
Introduction......Page 29
PART I: Background......Page 39
1 Introduction to the .NET Framework......Page 41
What Is .NET?......Page 42
Features of the .NET Framework......Page 44
Concepts Important for This Book......Page 50
Languages and Tools......Page 61
Conclusion......Page 74
2 Bridging the Two WorldsβManaged and Unmanaged Code......Page 75
Managed Code Versus Unmanaged Code......Page 76
How Unmanaged Code Interacts with Managed Code......Page 77
Conclusion......Page 100
Part II: Using COM Components in .NET Applications......Page 103
3 The Essentials for Using COM in Managed Code......Page 105
Referencing a COM Component in Visual Studio .NET......Page 106
Referencing a COM Component Using Only the .NET Framework SDK......Page 109
Example: A Spoken Hello, World Using the Microsoft Speech API......Page 111
The Type Library Importer......Page 112
Using COM Objects in ASP.NET Pages......Page 118
An Introduction to Interop Marshaling......Page 124
Common Interactions with COM Objects......Page 127
Using ActiveX Controls in .NET Applications......Page 148
Deploying a .NET Application That Uses COM......Page 154
Example: Using Microsoft Word to Check Spelling......Page 155
Conclusion......Page 165
4 An In-Depth Look at Imported Assemblies......Page 167
Converting the Library......Page 169
Converting COM Data Types......Page 171
Converting Methods and Properties......Page 190
Converting Interfaces......Page 205
Converting Classes......Page 207
Converting Modules......Page 215
Converting Structures......Page 217
Converting Unions......Page 219
Converting Enumerations......Page 221
Converting Typedefs......Page 222
Converting ActiveX Controls......Page 224
Conclusion......Page 227
5 Responding to COM Events......Page 229
Callbacks in .NET......Page 230
Callbacks in COM......Page 242
Handling COM Events in Managed Code......Page 246
Handling ActiveX Control Events in Managed Code......Page 263
Conclusion......Page 273
6 Advanced Topics for Using COM Components......Page 275
Do-It-Yourself Marshaling......Page 276
Threading and Apartments......Page 303
Troubleshooting an InvalidCastException......Page 317
Garbage Collection......Page 327
Securing Unmanaged Calls......Page 332
Using COM+ and DCOM Objects......Page 337
Inheriting from COM Classes......Page 339
Debugging into COM Components......Page 343
Monitoring Performance......Page 348
Conclusion......Page 349
7 Modifying Interop Assemblies......Page 351
How to Change an Assemblyβs Contents......Page 353
IL Assembler Syntax......Page 356
Changing Data Types......Page 368
Exposing Success HRESULTs......Page 370
Arrays......Page 376
Custom Attributes......Page 379
Adding Methods to Modules......Page 400
Conclusion......Page 402
Part III: Using .NET Components in COM Applications......Page 405
8 The Essentials for Using .NET Components from COM......Page 407
A Sample .NET Component......Page 408
Using a .NET Component in Visual Basic 6......Page 410
Using a .NET Component in Unmanaged Visual C++......Page 413
Using a .NET Component in Unmanaged JScript......Page 416
Assembly Registration......Page 418
The Type Library Exporter......Page 422
.NET Class Interfaces......Page 425
Interacting with a .NET Object......Page 427
Deploying a COM Application That Uses .NET......Page 443
Hosting Windows Forms Controls in Internet Explorer......Page 445
Conclusion......Page 450
9 An In-Depth Look at Exported Type Libraries......Page 453
Converting the Assembly......Page 454
Converting .NET Data Types......Page 457
Converting Members......Page 462
Converting Interfaces......Page 475
Converting Classes......Page 477
Converting Value Types......Page 480
Converting Enumerations......Page 481
Conclusion......Page 485
10 Advanced Topics for Using .NET Components......Page 487
Avoiding Registration......Page 488
Hosting Windows Forms Controls in Any ActiveX Container......Page 499
Working Around COM-Invisibility......Page 505
Using Reflection to Invoke Static Members......Page 510
Handling .NET Events......Page 516
Unexpected Casing in Type Libraries......Page 517
Advanced Shutdown Topics......Page 520
Conclusion......Page 521
Part IV: Designing Great .NET Components for COM Clients......Page 523
11 .NET Design Guidelines for Components Used by COM Clients......Page 525
Naming Guidelines......Page 527
Usage Guidelines......Page 534
Reporting Errors......Page 548
Exposing Enumerators to COM......Page 552
Versioning......Page 555
Deployment......Page 560
Testing Your Component from COM......Page 563
Conclusion......Page 565
12 Customizing COMβs View of .NET Components......Page 567
Customizing Data Types......Page 568
Customizing Structure Layout......Page 582
Exposing Class Interfaces......Page 584
Using Visual Basic .NETβs ComClassAttribute......Page 588
Making APIs Invisible to COM......Page 590
Customizing Registration......Page 593
Providing Your Own DISPIDs......Page 602
Controlling Interface Derivation......Page 606
Returning a Specific HRESULT......Page 607
Disabling Type Library Marshaling of .NET Interfaces......Page 608
Creating Multi-Cultured Methods......Page 610
Using Optional Parameters in Any Language......Page 611
Exposing .NET Objects As COM+ Objects......Page 612
Conclusion......Page 614
13 Exposing .NET Events to COM Clients......Page 619
Exposing Events Without Using Extra CLR Support......Page 620
Exposing Events Using Extra CLR Support......Page 626
Example: Handling a .NET Windows Formβs Events from COM......Page 639
Conclusion......Page 654
14 Implementing COM Interfaces for Binary Compatibility......Page 655
Getting Interface Definitions......Page 656
Binary Compatibility with Visual Basic 6 Classes......Page 657
Example: Implementing Office XP Smart Tag Interfaces......Page 662
Interface Implementation Shortcuts in Visual Studio .NET......Page 678
Common Problems When Implementing COM Interfaces......Page 681
COM Interfaces with Default CCW Implementations......Page 685
COM Interfaces Bridged to Different .NET Types......Page 706
Conclusion......Page 707
Part V: Designing Great COM Components for .NET Clients......Page 709
15 Creating and Deploying Useful Primary Interop Assemblies......Page 711
Primary Interop Assembly or Brand New Assembly?......Page 712
Creating a Primary Interop Assembly......Page 714
Deploying and Registering a Primary Interop Assembly......Page 722
Writing IDL That Produces Good Type Libraries......Page 725
What About ActiveX Controls?......Page 740
Conclusion......Page 741
16 COM Design Guidelines for Components Used by .NET Clients......Page 743
General Guidelines......Page 744
Using Array Parameters......Page 745
Reporting Errors......Page 748
Adjusting Certain COM-Specific Idioms......Page 757
Managing Limited Resources......Page 759
Threading and Apartment Guidelines......Page 761
Naming Guidelines......Page 762
Performance Considerations......Page 763
Conclusion......Page 766
17 Implementing .NET Interfaces for Type Compatibility......Page 767
Class Interfaces......Page 769
Interface Inheritance......Page 771
Considerations for Visual C++ Programmers......Page 775
Considerations for Visual Basic 6 Programmers......Page 787
Conclusion......Page 795
Part VI: Platform Invocation Services (PInvoke)......Page 797
18 The Essentials of PInvoke......Page 799
Using PInvoke in Visual Basic .NET......Page 801
Using PInvoke in Other .NET Languages......Page 804
Choosing the Right Parameter Types......Page 806
Customizing Declare and DllImportAttribute......Page 823
Conclusion......Page 835
19 Deeper Into PInvoke and Useful Examples......Page 837
Callbacks......Page 838
Passing Structures......Page 849
Handling Variable-Length Structures and Signatures......Page 875
Using C# Unsafe Code......Page 877
Guarding Against Premature Garbage Collection......Page 880
Choosing the DLL Location or Name Dynamically......Page 891
Example: Responding Immediately to Console Input......Page 893
Example: Clearing the Console Screen......Page 896
Example: Using CoCreateInstanceEx to Activate Remote COM Objects......Page 899
Conclusion......Page 903
Part VII: Advanced Topics......Page 905
20 Custom Marshaling......Page 907
Transforming Types Without Custom Marshaling......Page 910
Custom Marshaling Architecture......Page 923
Marshalers, Marshalers, Marshalers!......Page 941
Limitations......Page 980
Conclusion......Page 981
21 Manually Defining COM Types in Source Code......Page 985
Using SDK Tools for Support......Page 988
Manually Defining COM Interfaces......Page 990
Manually Defining Coclass Interfaces and Event Types......Page 1031
Manually Defining COM Structures......Page 1047
Manually Defining COM Classes......Page 1050
Avoiding the Balloon Effect......Page 1061
Conclusion......Page 1064
22 Using APIs Instead of SDK Tools......Page 1067
Generating an Assembly from a Type Library......Page 1068
Generating a Type Library from an Assembly......Page 1078
Registering and Unregistering Assemblies......Page 1084
Installing and Uninstalling Serviced Components......Page 1087
Example: Using the APIs in an Interactive Application......Page 1089
Conclusion......Page 1129
Part VIII: Comprehensive Examples......Page 1131
23 Writing a .NET Arcade Game Using DirectX......Page 1133
The Userβs Perspective......Page 1134
The Programmerβs Perspective......Page 1136
DirectX Interaction......Page 1140
The Game Class......Page 1147
Sounds and Pictures......Page 1161
Layers......Page 1178
Screens......Page 1183
The Actors......Page 1185
Using the Game Class......Page 1194
E-mail AttackβThe Advanced Version......Page 1199
Conclusion......Page 1222
24 Writing .NET Visualizations For Windows Media Player......Page 1223
The COM Visualization API......Page 1225
Creating a .NET Visualization API......Page 1229
Using the .NET Visualization API......Page 1252
Conclusion......Page 1271
Part IX: Appendices......Page 1275
A: System.Runtime.InteropServices Reference......Page 1277
The System.Runtime.InteropServices Namespace......Page 1278
The System.Runtime.InteropServices.CustomMarshalers Namespace......Page 1398
The System.Runtime.InteropServices.Expando Namespace......Page 1400
B: SDK Tools Reference......Page 1403
TLBIMP.EXE......Page 1404
TLBEXP.EXE......Page 1410
REGASM.EXE......Page 1413
AXIMP.EXE......Page 1418
REGSVCS.EXE......Page 1422
C: HRESULT to .NET Exception Transformations......Page 1427
D: .NET Exception to HRESULT Transformations......Page 1443
E: PInvoke Definitions for Win32 Functions......Page 1459
GDI32.DLL......Page 1461
KERNEL32.DLL......Page 1470
OLE32.DLL......Page 1489
SHELL32.DLL......Page 1498
USER32.DLL......Page 1500
F: Glossary......Page 1515
C......Page 1516
G......Page 1518
I......Page 1519
M......Page 1520
P......Page 1521
T......Page 1522
V......Page 1523
A......Page 1525
B......Page 1531
C......Page 1532
D......Page 1545
E......Page 1549
F......Page 1552
G......Page 1554
H......Page 1556
I......Page 1557
L......Page 1565
M......Page 1569
N......Page 1578
O......Page 1583
P......Page 1584
Q......Page 1588
R......Page 1589
S......Page 1591
T......Page 1598
U......Page 1602
V......Page 1603
W......Page 1606
X-Z......Page 1607
β¦ Subjects
Reference;Computer Science;Programming;Science;Technology
π SIMILAR VOLUMES
It's simple: you need to know how to work with the bash shell if you want to get to the heart of Mac OS X, Linux, and other Unix systems. Updated for the most recent version of bash, this concise little book puts all of the essential information about bash at your fingertips. You'll quickly find ans
In this handy pocket guide, mobile device expert Jason O'Grady reveals the secrets to using Google's Nexus One smartphone. All of the common features are covered including Web browsing, Google Apps, IM/text/email, digital camera, video, music player, & more.
"WordPress is so flexible that developers are now tapping it to create robust applications for content, contact, and e-mail management. Whether you're a casual blogger or programming pro, this comprehensive guide covers WordPress from the basics through advanced application development. Learn how to
Objective C 2.0 is the object-oriented language that is the basis for Cocoa and Cocoa Touch, the development environment for the iPhone/iPod Touch. You'll learn all the basics: from handling data and creating functions to managing memory and handling exceptions. For programmers who want to develop i
A complete introduction for beginners to Sun's powerful JavaFX scripting languageJavaFX is a scripting language which provides built-in properties for manipulating objects within a 2D coordinate system. A competing technology to Microsoft's Silverlight, JavaFX provides the tools to fill and pen stro