View Single Post
Join Date: Jun 2008
Posts: 9
Reputation: bmz is an unknown quantity at this point 
Solved Threads: 0
bmz bmz is offline Offline
Newbie Poster

how do you properly instantiate an activeX control on aspx

 
0
  #1
Aug 28th, 2008
hey... i currently making a web application, in VS 2008 - visual web developer 2008, for our final project and it makes use of an ocx which has methods to enable VOIP. What i did, since the control cannot be added to the tool box in order for it to be simply 'drag and drop'; i used aximp.exe to produce two dll's ATLH323Lib and AxATLH323Lib; i then referenced these two into my web application using Add Reference in the Solution Explorer.

My earlier error was that i always got an {ActiveX control 'fdd4c8c1-69c9-11d3-9dc8-525400e38cf9' cannot be instantiated because the current thread is not in a single-threaded apartment.} error when i did this... [code below]

  1. namespace WebVOIP
  2. {
  3.  
  4. public partial class _Default : System.Web.UI.Page
  5. {
  6. //flags to know status of caller
  7. static bool inComingCall;
  8. static bool onTheLine;
  9.  
  10. //variables in use
  11. static string newline = "\r\n";
  12.  
  13. //Objects that handles the VOIP capabilites of the site
  14.  
  15. private AxATLH323Lib.AxH323 ConnectionControl = new AxATLH323Lib.AxH323(); //ERROR points to this line
  16.  
  17. protected void Page_Load (object sender, EventArgs e)
  18. {
  19. ConnectionControl.Listen();
  20.  
  21. //ConnectionControl.ReceivingCall += new ATLH323Lib._IH323Events_ReceivingCallEventHandler(ConnectionControl_ReceivingCall);
  22. }
  23.  
  24. ....
  25.  
  26. }



Then i tried to do it like this ... [code below]

  1. namespace WebVOIP
  2. {
  3.  
  4. public partial class _Default : System.Web.UI.Page
  5. {
  6. //flags to know status of caller
  7. static bool inComingCall;
  8. static bool onTheLine;
  9.  
  10. //variables in use
  11. static string newline = "\r\n";
  12.  
  13. //Objects that handles the VOIP capabilites of the site
  14.  
  15. private AxATLH323Lib.AxH323 ConnectionControl;
  16.  
  17. protected void Page_Load (object sender, EventArgs e)
  18. {
  19. ConnectionControl = new AxATLH323Lib.AxH323();
  20. ConnectionControl.Listen();
  21.  
  22. //ConnectionControl.ReceivingCall += new ATLH323Lib._IH323Events_ReceivingCallEventHandler(ConnectionControl_ReceivingCall);
  23. }
  24.  
  25. ....
  26.  
  27. }

But then this error would appear... {Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.}

Help Please...
Last edited by peter_budo; Aug 31st, 2008 at 2:04 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote