Using .NET Objects from COM Clients

Now that you understand how to use COM objects from your managed code clients, let's look at the other side of the same coin: using a .NET object from a COM client. Once again, you face the problem of trying to bridge two very different object models (COM and .NET). In this case, you want a .NET object to be exposed to a COM/Win32 client as a COM object, and, once again, your interface should be as natural as possible. In other words, the .NET object should appear to the COM/Win32 client (for better or worse) to be just like any other COM object. You should be able to create the object using CoCreateInstance or one of the other COM activation functions. The object should expose the IUnknown interface that you ...

Get .NET and COM Interoperability Handbook, The 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.