Object Creation

In Chapter 6, I looked at using managed components from a COM/Win32 client at a very high level. In that chapter, you saw that, in order to use a .NET component from a COM/Win32 client, you had to insert registry entries for the .NET component that are similar to the entries required by a regular COM object. You also learned in Chapter 6 that, in order for a .NET object to be creatable from a COM client, it must have a default constructor, that is, a constructor that takes no arguments. The reason for this restriction is that the CoCreateInstance method—and the other object activation methods in the COM API--do not provide any means to pass initialization parameters to a COM object. Therefore, if an unmanaged client instantiates ...

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.