protected override void WndProc(ref Message m) { switch (m.Msg) { case WM_PARENTNOTIFY: if (!DesignMode) { if (m.WParam.ToInt32() == WM_DESTROY) { BrowserHelperObject.log("ExtendedWebBrowser", "WndProc", "handle destroy - closing"); Closing(this, EventArgs.Empty); /* * Message newMsg = new Message(); * newMsg.Msg = WM_DESTROY; * // Tell whoever cares we are closing * Form parent = this.Parent as Form; * if (parent != null) * parent.Close(); */ } } DefWndProc(ref m); break; default: base.WndProc(ref m); break; } }
private void browserControl_HandleDestroy(object sender, EventArgs e) { BrowserHelperObject.log("WebForm", "browserControl_HandleDestroy", "my form / trying to close"); // webBrowser1.closing = true; this.Close(); }