I'm trying to customize the behavior of the WebBrowser control in a Windows forms application. The follwing code works, but as soon as I call SetOptions I get a huge memory leak every time I navigate in the web browser. If I don't call SetOptions I get no memory leak.
Has anyone tried this before?
[ComVisible(true)]
public class CustomBrowser : System.Windows.Forms.WebBrowser, IOleClientSite
{
public void SetOptions()
{
IOleObject obj = (IOleObject)this.ActiveXInstance;
obj.SetClientSite(this);
}
[DispId(-5512)]
public virtual int IDispatch_Invoke_Handler()
{
return (int)(BrowserOptions.DontRunActiveX | BrowserOptions.NoJava | BrowserOptions.NoActiveXDownload | BrowserOptions.Silent | BrowserOptions.IgnoreCache);
}
#region IOleClientSite Members
public void SaveObject() { }
public void GetMoniker(uint dwAssign, uint dwWhichMoniker, object ppmk) { ppmk = null; }
public void GetContainer(object ppContainer) { ppContainer = null; }
public void ShowObject() { }
public void OnShowWindow(bool fShow) { }
public void RequestNewObjectLayout() { }
#endregion
}