ActiveX freezes IE

I created an activeX element to do some action that takes about 1 minute. IE freezes completely during this action. Is there a way to invoke the ActiveX control to keep IE from freezing?

thanks

+1


a source to share


3 answers


This is a threading issue related to IE, so I don't think there is a way to do it.



+1


a source


You will have the same problem on any ActiveX host, not just IE. If you don't want to block the UI thread, you need to modify your ActiveX control to do your work on the secondary thread.



+6


a source


I had a simulair problem with my activeX freezing IE. I was able to do a workaround by letting my ActiveX control create new threads on the client. Even that thread does its job, the ActiveX returns it and unlocks the interface.

The tricky part is knowing when the thread is executing. You can find out having a boolean property on your activeX that you set to true when the thread is finished. From javascript, you can keep referring to this property until its value is set to true.

JavaScript:

var myActiveXObject = new ActiveXObject("myActiveX");

function startWork()
{
    myActiveXObject.startWork();

    setTimeout(checkIsDone(), 1000);
}

function checkIsDone()
{
    if(myActiveXObject.checkIsDone())
        workComplete();
    else
        setTimeout(checkIsDone(), 1000);
}

      

ActiveX:

private bool blnIsDone;

[ComVisible(true)]
public void startWork()
{
   blnIsDone = false;

   Thread myThread = new Thread(delegate()
   {
       ThreadedWork();
   });

   myThread.Start();
}

private ThreadedWork()
{
    //Do work

    blnIsDone = true;
}

[ComVisible(true)]
public bool checkIsDone()
{
   return blnIsDone;
}

      

+4


a source







All Articles