WebBrowserExtensionsDestroyWindow Method |
Version 86.0.240
Manually call https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-destroywindow
passing in the handle returned from
GetWindowHandle.
This method can be used to manually close the underlying CefBrowser instance.
This will avoid the WM_Close message that CEF sends by default to the top level window.
(Which closes your application). This method should generally only be used in the WinForms version.
Namespace:
CefSharp.WinForms
Assembly:
CefSharp.WinForms (in CefSharp.WinForms.dll) Version: 86.0.240.0 (86.0.240.0)
Syntax public static bool DestroyWindow(
this IWebBrowser chromiumWebBrowser
)
public:
[ExtensionAttribute]
static bool DestroyWindow(
IWebBrowser^ chromiumWebBrowser
)
Parameters
- chromiumWebBrowser
- Type: CefSharpIWebBrowser
the ChromiumWebBrowser instance
Return Value
Type:
BooleanIf the function succeeds, the return value is true.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IWebBrowser. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Examples
Cef.UIThreadTaskFactory.StartNew(() =>
{
var closed = chromiumWebBrowser.DestroyWindow();
});
See Also