我是这样写的:public CoSmsEngineClass SmsEngine=new CoSmsEngineClass();SmsEngine.OnChannelChanged +=new ICoSmsEngineEvents_OnChannelChangedEventHandler(SmsEngine_OnChannelChanged);
SmsEngine.OnNewCall +=new ICoSmsEngineEvents_OnNewCallEventHandler(SmsEngine_OnNewCall);现在遇到这样的问题:
当只引用任意一个事件时,正确,引用两个事件时,就会报错未处理的“System.Runtime.InteropServices.COMException”类型的异常出现在 interop.engine.dll 中。其他信息: HRESULT 中的异常:0x80040202。请问这是什么原因?

解决方案 »

  1.   

    这就很难说了,看com如何写的了。
      

  2.   

    我用VB.net可以成功调用这个COM组件啊
      

  3.   

    to 我用VB.net可以成功调用这个COM组件啊如果vb.net可以,那么c#应该也没什么问题,你捕获一下,看看具体的错误是什么。
      

  4.   

    用exception.InnerException提示:
    未处理的“System.NullReferenceException”类型的异常出现在 WindowsApplication1.exe 中。
    其他信息: 未将对象引用设置到对象的实例。
    可是已经申明了啊public CoSmsEngineClass SmsEngine=new CoSmsEngineClass();
      

  5.   

    我这边同样的问题,"System.Runtime.InteropServices.COMException (0x800A000D): Type mismatch\r\n
      

  6.   

    考虑是否com对象已经释放
      

  7.   

    ms-help://MS.MSDNQTR.2003FEB.2052/cpguide/html/cpconmarshalingselectedinterfaces.htm