Chapter 22. Programming .NET and COM
Programmers love a clean slate. Although it would be nice if we could throw away all the code we’ve ever written and start over, that typically isn’t a viable option for most companies. Over the past decade, many development organizations have made a substantial investment in developing and purchasing COM components and ActiveX controls. If .NET is to be a viable platform, these legacy components must be usable from within .NET applications, and to a lesser degree, .NET components must be callable from COM.
This chapter describes the support .NET provides for importing ActiveX controls and COM components into your application, for exposing .NET classes to COM-based applications, and for making direct calls to Win32 APIs. You will also learn about C# pointers and keywords for accessing memory directly, a technique that may be crucial in some applications.
Importing ActiveX Controls
ActiveX controls are COM components typically dropped into a form, and which might or might not have a user interface. When Microsoft developed the OCX standard, which allowed developers to build ActiveX controls in Visual Basic and use them with C++ (and vice versa), the ActiveX control revolution began. Over the past few years, thousands of such controls have been developed, sold, and used. They are small, easy to work with, and an effective example of binary reuse.
Importing ActiveX controls into .NET is surprisingly easy, considering that the COM binary standard ...
Get Programming C# now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.