Skip to content

WinForms CreateBrowser Forcing form activation

Mohammed Osama Mohamed Sayed Ahmed edited this page May 31, 2019 · 1 revision
Windows WS_EX_NOACTIVATE

WinForms - CreateBrowser Forcing form activation #1811

Verify that a task bar button is created for the window (Windows 10)

Run CefSharp.exe --no-activate --off-screen-rendering-enabled

WS_EX_NOACTIVATE was made the default in a7a73dc

To re-enable activation by default then create a custom class that inherits from ChromiumWebBrowser and override the CreateBrowserWindowInfo method. Then it's a simple case of removing WS_EX_NOACTIVATE

from WindowInfo.ExStyle

const uint WS_EX_NOACTIVATE = 0x08000000;

windowInfo.ExStyle &= ~WS_EX_NOACTIVATE;

If there is enough demand then I will add a bool Property that can be used to enable/disable activation. It's not clear that there is enough demand at the moment, most people asking how to disable window activation as it's an unexpected behaviour.