I am receiving a COM Exception when trying to hook into an event on a COM Object. Here is the code I am trying to execute.
COMClass a = IComClass as ComClass;
a.SomeEvent += new SomeEvent_EventHandler(MethodNameHere);
Line two throws an exception of type COMException with the following information:
System.Runtime.InteropServices.COMException was caught
Message="Exception from HRESULT: 0x80040202"
Source="mscorlib"
ErrorCode=-2147220990
StackTrace: at System.Runtime.InteropServices.ComTypes.IConnectionPoint.Advise(Object pUnkSink, Int32& pdwCookie)
Does anyone have any ideas why I am unable to hook into a COM event or if there is a workaround for hooking into COM events?
Chris