Showing results for 
Search instead for 
Do you mean 

Preventing Add-Ons that use ActiveX controls from crashing ACT! on Close

Copper Contributor
Posts: 61
Country: USA

Preventing Add-Ons that use ActiveX controls from crashing ACT! on Close

Published 15 July 07 08:15 PM

When writing my ACTContactWebBrowser add-on, available in the downloads area of this site, I spent a fair bit of time trying to debug an issue where ACT! would "crash" when it is shutdown "sometimes".  the symptoms were  a crash dialog box every now and then when I try to close ACT!.  I isolated this to my add-on, but was a bit surprised since I had another add-on (the ContactOleDBGrid) which was essentially the same code but did not have the same issue.

I recently started work on another sample called "OutlookInsideACT" (more on that coming in a separate post in a few days), where Outlook views are embedded inside ACT! various areas (such as Dashboards and contact layouts).  Well, this add-on had the same issues as the Web Browser one, and were solved in the same way (got there quicker this time since I had solved it earlier). so, I thought I'd post to let everyone know what I had to do.

It all boiled down to the fact that the Web Browser control used an ActiveX under the cover and this was not being destroyed correctly (not sure why).So, I solved this by adding the following functions:
Note that the webBrowser variable refers to the WebBrowser control inside my add-on

// The web browser control seems to have an issue with being disposed correctly when it is sub-classed
// this event hooks the Application Exit event, so that the web browser control can be disposed of gracefully
// if you descend from WebBrowser directly, you may get Exceptions when shutting down ACT!
public ContactWebContextBrowser()
     Application.ApplicationExit +=
new EventHandler(Application_ApplicationExit);

// Dispose of the WebBrowser control if not already done
private void Application_ApplicationExit(Object sender, EventArgs e)
    if (webBrowser != null)
        webBrowser =

Hope this saves some time for someone out there.