I am working with the CDO COM DLL for handling .eml files. When I try to instantiate the MessengerClass class, VC#2010 tells me I have to instantiate using the interface e.g.
CDO.Message msg = new CDO.Message();
instead of
CDO.Message msg = new CDO.MessageClass();
How can this be? Wont all the functionality be missing from this instance?
This article says to do the same thing.
What am I missing? Does an interface still contain usable functionality?
The compiler translates
new COMInterface()into actual COM code that looks up the COM class that implements the interface.As I understand, COM interfaces do not have multiple implementations; instead, the runtime loads the implementation from appropriate DLL specified in HKCR\Classes{guid}.
(I don’t know much about COM, so this may be inaccurate.