Custom Designers for COM Objects

How do you define a non-default constructor for a COM object in Visual C ++?

Is it possible that is possible?

Or do you need to create a default object and use the init(params) method to configure it?

0
source share
1 answer

COM COM classes implemented in C ++ cannot have a constructor that takes an argument. The CoCreateObject () function, the primary way to instantiate a coclass, has no way to pass arguments. Same thing with IClassFactory :: CreateInstance (), the main method.

So yes, this is not possible, you will need the Initialize () method. And the code to verify that it was called, E_UNEXPECTED with a decent message IErrorInfo is a template.

+3
source

All Articles