private void AttachInterceptorToChromiumBrowser() { Task.Factory.StartNew(() => { try { while (true) { IntPtr chromeWidgetHostHandle = IntPtr.Zero; if (BrowserWidgetHandleFinder.TryFindHandle(BrowserHandle, out chromeWidgetHostHandle)) { messageInterceptor = new BrowserWidgetMessageInterceptor(browser, chromeWidgetHostHandle, OnWebBroswerMessage); break; } else { System.Threading.Thread.Sleep(0); } } } catch { } }); }
//protected override void OnMouseDown(MouseEventArgs e) //{ // base.OnMouseDown(e); // if (Resizable && ResizeDirection != HitTest.HTNOWHERE) // { // User32.SendMessage(Handle, (uint)WindowsMessages.WM_NCLBUTTONDOWN, (IntPtr)ResizeDirection, (IntPtr)0); // User32.InvalidateWindow(Handle); // } //} protected override void OnClosed(EventArgs e) { messageInterceptor?.ReleaseHandle(); messageInterceptor?.DestroyHandle(); messageInterceptor = null; browser.Dispose(); base.OnClosed(e); }
protected override void OnClosed(EventArgs e) { messageInterceptor?.ReleaseHandle(); messageInterceptor?.DestroyHandle(); messageInterceptor = null; base.OnClosed(e); nativeForm?.ReleaseHandle(); nativeForm?.DestroyHandle(); }
protected void Dispose() { if (messageInterceptor != null) { messageInterceptor.ReleaseHandle(); messageInterceptor.DestroyHandle(); } messageInterceptor = null; if (nativeForm != null) { nativeForm.ReleaseHandle(); nativeForm.DestroyHandle(); } }
protected override void OnClosed(EventArgs e) { if (messageInterceptor != null) { messageInterceptor.ReleaseHandle(); messageInterceptor.DestroyHandle(); } messageInterceptor = null; base.OnClosed(e); if (nativeForm != null) { nativeForm.ReleaseHandle(); nativeForm.DestroyHandle(); } }