ActiveX Control Dispose (true) not called

My C # ActiveX Control is the host in IE 8. I want to execute code when the control is unloaded.

I tried the following:

...
public class ActiveXControl : Control 
{
    protected override void Dispose(bool disposing) 
    {
        if (disposing) 
        {
            // Cleanup
        }
    }
}
...

But utilization is always false (called from the finalizer). Since I need to access managed objects, I cannot use this one.

How can I get the cleanup code that gets called when the browser unloads the control?

I found the IOleObject :: Close method, which is implemented by the Control class, but AFAIK is not a way to override its behavior.

+3
source share
2 answers

, : , javascript, html -, activeX, . .

+1

OnHandleDestroyed(), , IE .

+1

Source: https://habr.com/ru/post/1786656/


All Articles