arsd.webview

A thin wrapper around common system webviews. Based on: https://github.com/zserge/webview

Work in progress. DO NOT USE YET as I am prolly gonna break everything.

Public Imports

core.sys.windows.windows
public import core.sys.windows.windows;
core.sys.windows.unknwn
public import core.sys.windows.unknwn;
core.sys.windows.oaidl
public import core.sys.windows.oaidl;
core.sys.windows.objidl
public import core.sys.windows.objidl;

Members

Classes

WebView
class WebView

Enums

COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT_PNG
anonymousenum COREWEBVIEW2_CAPTURE_PREVIEW_IMAGE_FORMAT_PNG

Image format used by the ICoreWebView2::CapturePreview method.

COREWEBVIEW2_KEY_EVENT_KIND_KEY_DOWN
anonymousenum COREWEBVIEW2_KEY_EVENT_KIND_KEY_DOWN

The type of key event that triggered an AcceleratorKeyPressed event.

COREWEBVIEW2_MOVE_FOCUS_REASON_PROGRAMMATIC
anonymousenum COREWEBVIEW2_MOVE_FOCUS_REASON_PROGRAMMATIC

Reason for moving focus.

COREWEBVIEW2_PERMISSION_KIND_UNKNOWN_PERMISSION
anonymousenum COREWEBVIEW2_PERMISSION_KIND_UNKNOWN_PERMISSION

The type of a permission request.

COREWEBVIEW2_PERMISSION_STATE_DEFAULT
anonymousenum COREWEBVIEW2_PERMISSION_STATE_DEFAULT

Response to a permission request.

COREWEBVIEW2_PROCESS_FAILED_KIND_BROWSER_PROCESS_EXITED
anonymousenum COREWEBVIEW2_PROCESS_FAILED_KIND_BROWSER_PROCESS_EXITED

Kind of process failure used in the ICoreWebView2ProcessFailedEventHandler interface.

COREWEBVIEW2_SCRIPT_DIALOG_KIND_ALERT
anonymousenum COREWEBVIEW2_SCRIPT_DIALOG_KIND_ALERT

Kind of JavaScript dialog used in the ICoreWebView2ScriptDialogOpeningEventHandler interface.

COREWEBVIEW2_WEB_ERROR_STATUS_UNKNOWN
anonymousenum COREWEBVIEW2_WEB_ERROR_STATUS_UNKNOWN

Error status values for web navigations.

COREWEBVIEW2_WEB_RESOURCE_CONTEXT_ALL
anonymousenum COREWEBVIEW2_WEB_RESOURCE_CONTEXT_ALL

Enum for web resource request contexts.

Functions

CompareBrowserVersions
HRESULT CompareBrowserVersions(PCWSTR version1, PCWSTR version2, int* result)

This method is for anyone want to compare version correctly to determine which version is newer, older or same. It can be used to determine whether to use webview2 or certain feature base on version. Sets the value of result to -1, 0 or 1 if version1 is less than, equal or greater than version2 respectively. Returns E_INVALIDARG if it fails to parse any of the version strings or any input parameter is null. Input can directly use the versionInfo obtained from GetAvailableCoreWebView2BrowserVersionString, channel info will be ignored.

CreateCoreWebView2Environment
HRESULT CreateCoreWebView2Environment(ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler environmentCreatedHandler)

Creates an evergreen WebView2 Environment using the installed Edge version. This is equivalent to calling CreateCoreWebView2EnvironmentWithOptions with nullptr for browserExecutableFolder, userDataFolder, additionalBrowserArguments. See CreateCoreWebView2EnvironmentWithOptions for more details.

CreateCoreWebView2EnvironmentWithOptions
HRESULT CreateCoreWebView2EnvironmentWithOptions(PCWSTR browserExecutableFolder, PCWSTR userDataFolder, ICoreWebView2EnvironmentOptions environmentOptions, ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler environmentCreatedHandler)

DLL export to create a WebView2 environment with a custom version of Edge, user data directory and/or additional options.

GetAvailableCoreWebView2BrowserVersionString
HRESULT GetAvailableCoreWebView2BrowserVersionString(PCWSTR browserExecutableFolder, LPWSTR* versionInfo)

Get the browser version info including channel name if it is not the stable channel or the Embedded Edge. Channel names are beta, dev, and canary. If an override exists for the browserExecutableFolder or the channel preference, the override will be used. If there isn't an override, then the parameter passed to GetAvailableCoreWebView2BrowserVersionString is used.

Interfaces

ICoreWebView2
interface ICoreWebView2
Undocumented in source.
ICoreWebView2AcceleratorKeyPressedEventArgs
interface ICoreWebView2AcceleratorKeyPressedEventArgs
Undocumented in source.
ICoreWebView2AcceleratorKeyPressedEventHandler
interface ICoreWebView2AcceleratorKeyPressedEventHandler
Undocumented in source.
ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler
interface ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler
Undocumented in source.
ICoreWebView2CallDevToolsProtocolMethodCompletedHandler
interface ICoreWebView2CallDevToolsProtocolMethodCompletedHandler
Undocumented in source.
ICoreWebView2CapturePreviewCompletedHandler
interface ICoreWebView2CapturePreviewCompletedHandler
Undocumented in source.
ICoreWebView2ContainsFullScreenElementChangedEventHandler
interface ICoreWebView2ContainsFullScreenElementChangedEventHandler
Undocumented in source.
ICoreWebView2ContentLoadingEventArgs
interface ICoreWebView2ContentLoadingEventArgs
Undocumented in source.
ICoreWebView2ContentLoadingEventHandler
interface ICoreWebView2ContentLoadingEventHandler
Undocumented in source.
ICoreWebView2Controller
interface ICoreWebView2Controller
Undocumented in source.
ICoreWebView2CreateCoreWebView2ControllerCompletedHandler
interface ICoreWebView2CreateCoreWebView2ControllerCompletedHandler
Undocumented in source.
ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler
interface ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler
Undocumented in source.
ICoreWebView2Deferral
interface ICoreWebView2Deferral
Undocumented in source.
ICoreWebView2DevToolsProtocolEventReceivedEventArgs
interface ICoreWebView2DevToolsProtocolEventReceivedEventArgs
Undocumented in source.
ICoreWebView2DevToolsProtocolEventReceivedEventHandler
interface ICoreWebView2DevToolsProtocolEventReceivedEventHandler
Undocumented in source.
ICoreWebView2DevToolsProtocolEventReceiver
interface ICoreWebView2DevToolsProtocolEventReceiver
Undocumented in source.
ICoreWebView2DocumentTitleChangedEventHandler
interface ICoreWebView2DocumentTitleChangedEventHandler
Undocumented in source.
ICoreWebView2Environment
interface ICoreWebView2Environment
Undocumented in source.
ICoreWebView2EnvironmentOptions
interface ICoreWebView2EnvironmentOptions
Undocumented in source.
ICoreWebView2ExecuteScriptCompletedHandler
interface ICoreWebView2ExecuteScriptCompletedHandler
Undocumented in source.
ICoreWebView2FocusChangedEventHandler
interface ICoreWebView2FocusChangedEventHandler
Undocumented in source.
ICoreWebView2HistoryChangedEventHandler
interface ICoreWebView2HistoryChangedEventHandler
Undocumented in source.
ICoreWebView2HttpHeadersCollectionIterator
interface ICoreWebView2HttpHeadersCollectionIterator
Undocumented in source.
ICoreWebView2HttpRequestHeaders
interface ICoreWebView2HttpRequestHeaders
Undocumented in source.
ICoreWebView2HttpResponseHeaders
interface ICoreWebView2HttpResponseHeaders
Undocumented in source.
ICoreWebView2MoveFocusRequestedEventArgs
interface ICoreWebView2MoveFocusRequestedEventArgs
Undocumented in source.
ICoreWebView2MoveFocusRequestedEventHandler
interface ICoreWebView2MoveFocusRequestedEventHandler
Undocumented in source.
ICoreWebView2NavigationCompletedEventArgs
interface ICoreWebView2NavigationCompletedEventArgs
Undocumented in source.
ICoreWebView2NavigationCompletedEventHandler
interface ICoreWebView2NavigationCompletedEventHandler
Undocumented in source.
ICoreWebView2NavigationStartingEventArgs
interface ICoreWebView2NavigationStartingEventArgs
Undocumented in source.
ICoreWebView2NavigationStartingEventHandler
interface ICoreWebView2NavigationStartingEventHandler
Undocumented in source.
ICoreWebView2NewBrowserVersionAvailableEventHandler
interface ICoreWebView2NewBrowserVersionAvailableEventHandler
Undocumented in source.
ICoreWebView2NewWindowRequestedEventArgs
interface ICoreWebView2NewWindowRequestedEventArgs
Undocumented in source.
ICoreWebView2NewWindowRequestedEventHandler
interface ICoreWebView2NewWindowRequestedEventHandler
Undocumented in source.
ICoreWebView2PermissionRequestedEventArgs
interface ICoreWebView2PermissionRequestedEventArgs
Undocumented in source.
ICoreWebView2PermissionRequestedEventHandler
interface ICoreWebView2PermissionRequestedEventHandler
Undocumented in source.
ICoreWebView2ProcessFailedEventArgs
interface ICoreWebView2ProcessFailedEventArgs
Undocumented in source.
ICoreWebView2ProcessFailedEventHandler
interface ICoreWebView2ProcessFailedEventHandler
Undocumented in source.
ICoreWebView2ScriptDialogOpeningEventArgs
interface ICoreWebView2ScriptDialogOpeningEventArgs
Undocumented in source.
ICoreWebView2ScriptDialogOpeningEventHandler
interface ICoreWebView2ScriptDialogOpeningEventHandler
Undocumented in source.
ICoreWebView2Settings
interface ICoreWebView2Settings
Undocumented in source.
ICoreWebView2SourceChangedEventArgs
interface ICoreWebView2SourceChangedEventArgs
Undocumented in source.
ICoreWebView2SourceChangedEventHandler
interface ICoreWebView2SourceChangedEventHandler
Undocumented in source.
ICoreWebView2WebMessageReceivedEventArgs
interface ICoreWebView2WebMessageReceivedEventArgs
Undocumented in source.
ICoreWebView2WebMessageReceivedEventHandler
interface ICoreWebView2WebMessageReceivedEventHandler
Undocumented in source.
ICoreWebView2WebResourceRequest
interface ICoreWebView2WebResourceRequest
Undocumented in source.
ICoreWebView2WebResourceRequestedEventArgs
interface ICoreWebView2WebResourceRequestedEventArgs
Undocumented in source.
ICoreWebView2WebResourceRequestedEventHandler
interface ICoreWebView2WebResourceRequestedEventHandler
Undocumented in source.
ICoreWebView2WebResourceResponse
interface ICoreWebView2WebResourceResponse
Undocumented in source.
ICoreWebView2WindowCloseRequestedEventHandler
interface ICoreWebView2WindowCloseRequestedEventHandler
Undocumented in source.
ICoreWebView2WindowFeatures
interface ICoreWebView2WindowFeatures
Undocumented in source.
ICoreWebView2ZoomFactorChangedEventHandler
interface ICoreWebView2ZoomFactorChangedEventHandler
Undocumented in source.

Structs

COREWEBVIEW2_PHYSICAL_KEY_STATUS
struct COREWEBVIEW2_PHYSICAL_KEY_STATUS

A structure representing the information packed into the LPARAM given to a Win32 key event. See the documentation for WM_KEYDOWN for details at https://docs.microsoft.com/windows/win32/inputdev/wm-keydown

Variables

IID_ICoreWebView2
GUID IID_ICoreWebView2;

WebView2 enables you to host web content using the latest Edge web browser technology.

IID_ICoreWebView2AcceleratorKeyPressedEventArgs
GUID IID_ICoreWebView2AcceleratorKeyPressedEventArgs;

Event args for the AcceleratorKeyPressed event.

IID_ICoreWebView2AcceleratorKeyPressedEventHandler
GUID IID_ICoreWebView2AcceleratorKeyPressedEventHandler;

The caller implements this interface to receive the AcceleratorKeyPressed event.

IID_ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler
GUID IID_ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler;

The caller implements this interface to receive the result of the AddScriptToExecuteOnDocumentCreated method.

IID_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler
GUID IID_ICoreWebView2CallDevToolsProtocolMethodCompletedHandler;

The caller implements this interface to receive CallDevToolsProtocolMethod completion results.

IID_ICoreWebView2CapturePreviewCompletedHandler
GUID IID_ICoreWebView2CapturePreviewCompletedHandler;

The caller implements this method to receive the result of the CapturePreview method. The result is written to the stream provided in the CapturePreview method call.

IID_ICoreWebView2ContainsFullScreenElementChangedEventHandler
GUID IID_ICoreWebView2ContainsFullScreenElementChangedEventHandler;

The caller implements this method to receive the ContainsFullScreenElementChanged events. There are no event args for this event.

IID_ICoreWebView2ContentLoadingEventArgs
GUID IID_ICoreWebView2ContentLoadingEventArgs;

Event args for the ContentLoading event.

IID_ICoreWebView2ContentLoadingEventHandler
GUID IID_ICoreWebView2ContentLoadingEventHandler;

The caller implements this interface to receive the ContentLoading event.

IID_ICoreWebView2Controller
GUID IID_ICoreWebView2Controller;

This interface is the owner of the CoreWebView2 object, and provides support for resizing, showing and hiding, focusing, and other functionality related to windowing and composition. The CoreWebView2Controller owns the CoreWebView2, and if all references to the CoreWebView2Controller go away, the WebView will be closed.

IID_ICoreWebView2CreateCoreWebView2ControllerCompletedHandler
GUID IID_ICoreWebView2CreateCoreWebView2ControllerCompletedHandler;

The caller implements this interface to receive the CoreWebView2Controller created via CreateCoreWebView2Controller.

IID_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler
GUID IID_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler;

The caller implements this interface to receive the WebView2Environment created via CreateCoreWebView2Environment.

IID_ICoreWebView2Deferral
GUID IID_ICoreWebView2Deferral;

This interface is used to complete deferrals on event args that support getting deferrals via their GetDeferral method.

IID_ICoreWebView2DevToolsProtocolEventReceivedEventArgs
GUID IID_ICoreWebView2DevToolsProtocolEventReceivedEventArgs;

Event args for the DevToolsProtocolEventReceived event.

IID_ICoreWebView2DevToolsProtocolEventReceivedEventHandler
GUID IID_ICoreWebView2DevToolsProtocolEventReceivedEventHandler;

The caller implements this interface to receive DevToolsProtocolEventReceived events from the WebView.

IID_ICoreWebView2DevToolsProtocolEventReceiver
GUID IID_ICoreWebView2DevToolsProtocolEventReceiver;

A Receiver is created for a particular DevTools Protocol event and allows you to subscribe and unsubscribe from that event. Obtained from the WebView object via GetDevToolsProtocolEventReceiver.

IID_ICoreWebView2DocumentTitleChangedEventHandler
GUID IID_ICoreWebView2DocumentTitleChangedEventHandler;

The caller implements this interface to receive DocumentTitleChanged events. Use the DocumentTitle property to get the modified title.

IID_ICoreWebView2Environment
GUID IID_ICoreWebView2Environment;

This represents the WebView2 Environment. WebViews created from an environment run on the browser process specified with environment parameters and objects created from an environment should be used in the same environment. Using it in different environments are not guaranteed to be compatible and may fail.

IID_ICoreWebView2EnvironmentOptions
GUID IID_ICoreWebView2EnvironmentOptions;

Options used to create WebView2 Environment.

IID_ICoreWebView2ExecuteScriptCompletedHandler
GUID IID_ICoreWebView2ExecuteScriptCompletedHandler;

The caller implements this interface to receive the result of the ExecuteScript method.

IID_ICoreWebView2FocusChangedEventHandler
GUID IID_ICoreWebView2FocusChangedEventHandler;

The caller implements this method to receive the GotFocus and LostFocus events. There are no event args for this event.

IID_ICoreWebView2HistoryChangedEventHandler
GUID IID_ICoreWebView2HistoryChangedEventHandler;

The caller implements this interface to receive the HistoryChanged event.

IID_ICoreWebView2HttpHeadersCollectionIterator
GUID IID_ICoreWebView2HttpHeadersCollectionIterator;

Iterator for a collection of HTTP headers. See ICoreWebView2HttpRequestHeaders and ICoreWebView2HttpResponseHeaders.

IID_ICoreWebView2HttpRequestHeaders
GUID IID_ICoreWebView2HttpRequestHeaders;

HTTP request headers. Used to inspect the HTTP request on WebResourceRequested event and NavigationStarting event. Note, you can modify the HTTP request headers from a WebResourceRequested event, but not from a NavigationStarting event.

IID_ICoreWebView2HttpResponseHeaders
GUID IID_ICoreWebView2HttpResponseHeaders;

HTTP response headers. Used to construct a WebResourceResponse for the WebResourceRequested event.

IID_ICoreWebView2MoveFocusRequestedEventArgs
GUID IID_ICoreWebView2MoveFocusRequestedEventArgs;

Event args for the MoveFocusRequested event.

IID_ICoreWebView2MoveFocusRequestedEventHandler
GUID IID_ICoreWebView2MoveFocusRequestedEventHandler;

The caller implements this method to receive the MoveFocusRequested event.

IID_ICoreWebView2NavigationCompletedEventArgs
GUID IID_ICoreWebView2NavigationCompletedEventArgs;

Event args for the NavigationCompleted event.

IID_ICoreWebView2NavigationCompletedEventHandler
GUID IID_ICoreWebView2NavigationCompletedEventHandler;

The caller implements this interface to receive the NavigationCompleted event.

IID_ICoreWebView2NavigationStartingEventArgs
GUID IID_ICoreWebView2NavigationStartingEventArgs;

Event args for the NavigationStarting event.

IID_ICoreWebView2NavigationStartingEventHandler
GUID IID_ICoreWebView2NavigationStartingEventHandler;

The caller implements this interface to receive the NavigationStarting event.

IID_ICoreWebView2NewBrowserVersionAvailableEventHandler
GUID IID_ICoreWebView2NewBrowserVersionAvailableEventHandler;

The caller implements this interface to receive NewBrowserVersionAvailable events.

IID_ICoreWebView2NewWindowRequestedEventArgs
GUID IID_ICoreWebView2NewWindowRequestedEventArgs;

Event args for the NewWindowRequested event. The event is fired when content inside webview requested to a open a new window (through window.open() and so on.)

IID_ICoreWebView2NewWindowRequestedEventHandler
GUID IID_ICoreWebView2NewWindowRequestedEventHandler;

The caller implements this interface to receive NewWindowRequested events.

IID_ICoreWebView2PermissionRequestedEventArgs
GUID IID_ICoreWebView2PermissionRequestedEventArgs;

Event args for the PermissionRequested event.

IID_ICoreWebView2PermissionRequestedEventHandler
GUID IID_ICoreWebView2PermissionRequestedEventHandler;

The caller implements this interface to receive the PermissionRequested event.

IID_ICoreWebView2ProcessFailedEventArgs
GUID IID_ICoreWebView2ProcessFailedEventArgs;

Event args for the ProcessFailed event.

IID_ICoreWebView2ProcessFailedEventHandler
GUID IID_ICoreWebView2ProcessFailedEventHandler;

The caller implements this interface to receive ProcessFailed events.

IID_ICoreWebView2ScriptDialogOpeningEventArgs
GUID IID_ICoreWebView2ScriptDialogOpeningEventArgs;

Event args for the ScriptDialogOpening event.

IID_ICoreWebView2ScriptDialogOpeningEventHandler
GUID IID_ICoreWebView2ScriptDialogOpeningEventHandler;

The caller implements this interface to receive the ScriptDialogOpening event.

IID_ICoreWebView2Settings
GUID IID_ICoreWebView2Settings;

Defines properties that enable, disable, or modify WebView features. Setting changes made after NavigationStarting event will not apply until the next top level navigation.

IID_ICoreWebView2SourceChangedEventArgs
GUID IID_ICoreWebView2SourceChangedEventArgs;

Event args for the SourceChanged event.

IID_ICoreWebView2SourceChangedEventHandler
GUID IID_ICoreWebView2SourceChangedEventHandler;

The caller implements this interface to receive the SourceChanged event.

IID_ICoreWebView2WebMessageReceivedEventArgs
GUID IID_ICoreWebView2WebMessageReceivedEventArgs;

Event args for the WebMessageReceived event.

IID_ICoreWebView2WebMessageReceivedEventHandler
GUID IID_ICoreWebView2WebMessageReceivedEventHandler;

The caller implements this interface to receive the WebMessageReceived event.

IID_ICoreWebView2WebResourceRequest
GUID IID_ICoreWebView2WebResourceRequest;

An HTTP request used with the WebResourceRequested event.

IID_ICoreWebView2WebResourceRequestedEventArgs
GUID IID_ICoreWebView2WebResourceRequestedEventArgs;

Event args for the WebResourceRequested event.

IID_ICoreWebView2WebResourceRequestedEventHandler
GUID IID_ICoreWebView2WebResourceRequestedEventHandler;

Fires when a URL request (through network, file etc.) is made in the webview for a Web resource matching resource context filter and URL specified in AddWebResourceRequestedFilter. The host can view and modify the request or provide a response in a similar pattern to HTTP, in which case the request immediately completed. This may not contain any request headers that are added by the network stack, such as Authorization headers.

IID_ICoreWebView2WebResourceResponse
GUID IID_ICoreWebView2WebResourceResponse;

An HTTP response used with the WebResourceRequested event.

IID_ICoreWebView2WindowCloseRequestedEventHandler
GUID IID_ICoreWebView2WindowCloseRequestedEventHandler;

The caller implements this interface to receive NewWindowRequested events.

IID_ICoreWebView2WindowFeatures
GUID IID_ICoreWebView2WindowFeatures;

Window features for a WebView popup window. These fields match the 'windowFeatures' passed to window.open as specified in https://developer.mozilla.org/en-US/docs/Web/API/Window/open#Window_features

There is no requirement for you to respect these values. If your app doesn't have corresponding UI features, for example no toolbar, or if all webviews are opened in tabs and so cannot have distinct size or positions, then your app cannot respect these values. You may want to respect values but perhaps only some can apply to your app's UI. Accordingly, it is fine to respect all, some, or none of these properties as appropriate based on your app. For all numeric properties, if the value when passed to window.open is outside the range of an unsigned 32bit int, the value will be mod of the max of unsigned 32bit integer. If the value cannot be parsed as an integer it will be considered 0. If the value is a floating point value, it will be rounded down to an integer.

IID_ICoreWebView2ZoomFactorChangedEventHandler
GUID IID_ICoreWebView2ZoomFactorChangedEventHandler;

The caller implements this interface to receive ZoomFactorChanged events. Use the ICoreWebView2Controller.ZoomFactor property to get the modified zoom factor.

Suggestion Box / Bug Report