ActiveX freezes IE
3 answers
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 to share