Calling COM from .NET Code
Most likely a programmer will want to use old COM-based code in new .NET applications (rather than the other way around), for the simple reason that there is probably much more COM code out there than .NET code. (Eventually the momentum will shift and COM will likely be left by the roadside somewhere, but that day is still a long way off.) Let's start with how the mechanism for using COM in .NET works in general, and then we'll continue with an example.
When you want to use an old VB6 COM object (or some other language-based COM object) in .NET, .NET wraps a runtime callable wrapper (RCW) around the COM binary. This RCW manifests itself as an assembly named Interop.<assemblyname>.dll, where <assemblyname> is the name ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access