/// <summary> /// Browser initialized changed event handler. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="eventArgs"> /// The event args. /// </param> private void IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs eventArgs) { if (eventArgs.IsBrowserInitialized) { var size = GetClientSize(); mBrowser.SetSize(size.Width, size.Height); mBrowser.IsBrowserInitializedChanged -= IsBrowserInitializedChanged; mBrowserHandle = mBrowser.GetBrowserHost().GetWindowHandle(); var childWindowsDetails = new EnumChildWindowsDetails(); var gcHandle = GCHandle.Alloc(childWindowsDetails); EnumChildWindows(Handle, new EnumWindowProc(EnumWindow), GCHandle.ToIntPtr(gcHandle)); foreach (ChildWindow childWindow in childWindowsDetails.Windows) { var wndProcOverride = new WndProcOverride(childWindow.Handle, childWindow.ClassName, mBrowser, Handle); wndProcOverrides.Add(wndProcOverride); } childWindows = childWindowsDetails.Windows; gcHandle.Free(); } }
/// <summary> /// The browser created. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void OnBrowserCreated(object sender, EventArgs e) { mBrowserWindowHandle = mBrowser.CefBrowser.GetHost().GetWindowHandle(); if (mBrowserWindowHandle != IntPtr.Zero) { var size = GetClientSize(); NativeMethods.SetWindowPos(mBrowserWindowHandle, IntPtr.Zero, 0, 0, size.Width, size.Height, WindowPositionFlags.SWP_NOZORDER); if (mHostConfig.HostFrameless) { var childWindowsDetails = new EnumChildWindowsDetails(); var gcHandle = GCHandle.Alloc(childWindowsDetails); EnumChildWindows(Handle, new EnumWindowProc(EnumWindow), GCHandle.ToIntPtr(gcHandle)); foreach (ChildWindow childWindow in childWindowsDetails.Windows) { var wndProcOverride = new WndProcOverride(childWindow.Handle, childWindow.ClassName); wndProcOverrides.Add(wndProcOverride); } childWindows = childWindowsDetails.Windows; gcHandle.Free(); } } }
/// <summary> /// Initializes a new instance of the <see cref="FocusChildForm"/> class. /// </summary> public FocusChildForm() { InitializeComponent(); this.ForceActiveBar = true; wndProc = new WndProcOverride(this, new WndProcHandler(HandleNcActivate) { MessageId = (int)NativeEnums.WM.NCACTIVATE }); }
/// <summary> /// Initializes a new instance of the <see cref="FocusParentForm"/> class. /// </summary> public FocusParentForm() { InitializeComponent(); wndProc = new WndProcOverride(this, new WndProcHandler(HandleNcActivate) { MessageId = (int)NativeEnums.WM.NCACTIVATE }, new WndProcHandler(HandleAppActivate) { MessageId = (int)NativeEnums.WM.ACTIVATEAPP }); }