tags:

views:

21

answers:

1

Hello,

I have a two ActiveX servers I need to handle it's events. the first one I got to work with no problems but with the second one I get a error once I try to assign a new event. The one that works the code is below:

   public delegate void ICwGetXEvents_OnCommandExEventHandler(uint CommandW, uint CommandL, string CommandText);

     public CwGet.CwGetXClass ax_CwGet;

    //event
      public void CwGetXEvents_OnCommandExEventHandler(uint CommandW, uint CommandL, string CommandText)
        {

          if (CommandL == 4)
            {
               //some code
            }


        }

//ok here is how I assign the controls and event:

 ax_CwGet = new CwGetXClass();
 ax_CwGet.OnCommandEx += CwGetXEvents_OnCommandExEventHandler;

Ok with the second control(by the way it was created by the same company) I try the same thing:

public delegate void ITrueTtyXEvents_OnCallsignEventHandler(string Call);
public truetty.TrueTtyXClass ax_truetty;

//event
    public void TrueTtyXEvents_OnCallsignEventHandler(string Call)
        {
           //somecode
        } 

ax_truetty = new TrueTtyXClass();
ax_truetty.OnCallsign+= TrueTtyXEvents_OnCallsignEventHandler;

However when I create the new ActiveX object which works but when I go to assign the event I get this error:

"An outgoing call cannot be made since the application is dispatching an input-synchronous call. (Exception from HRESULT: 0x8001010D (RPC_E_CANTCALLOUT_ININPUTSYNCCALL))"

was wondering if anyone could point me in the right direction..

Mike

A: 

This is a threading problem. You should ask the component vendor for help with this, sounds like they didn't set the ThreadingModel registry key properly. But the likely response you'll get is "do not use them from a worker thread, only from an STA thread". Which is very common for ActiveX controls.

Hans Passant