Implement COM Event Interface RRS feed

  • Question

  • There is a COM library that define COM event interface as:

        public interface IAnnotationErrorEvents
            void ErrorAddingElements();
            bool TooManyOverflow(int numOverflow);
    I need to implement this event interface in my .NET object. MSDN library says that interface has to have attribute [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] to be able to implement it in .NET object.

    But in my case I don't specify interface in my code. It is imported from existent library and it is already defined as [InterfaceType(1)]. It is equivalent to [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)].

    As I understand implementation has to be like next code in case when InterfaceType is correct
    class ImplementationClass
    public event IAnnotationErrorEvents_ErrorAddingElementsEventHandler ErrorAddingElements;



    event IAnnotationErrorEvents_TooManyOverflowEventHandler TooManyOverflow;

    Is there any way to implement such Event Interface with InterfaceIsIUnknown?

    Friday, December 11, 2009 5:35 PM


All replies