ICoreWebView2CompositionController

Undocumented in source.

Members

Functions

SendMouseInput
HRESULT SendMouseInput(COREWEBVIEW2_MOUSE_EVENT_KIND eventKind, COREWEBVIEW2_MOUSE_EVENT_VIRTUAL_KEYS virtualKeys, UINT32 mouseData, POINT point)

If eventKind is COREWEBVIEW2_MOUSE_EVENT_KIND_HORIZONTAL_WHEEL or COREWEBVIEW2_MOUSE_EVENT_KIND_WHEEL, then mouseData specifies the amount of wheel movement. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. One wheel click is defined as WHEEL_DELTA, which is 120. If eventKind is COREWEBVIEW2_MOUSE_EVENT_KIND_X_BUTTON_DOUBLE_CLICK COREWEBVIEW2_MOUSE_EVENT_KIND_X_BUTTON_DOWN, or COREWEBVIEW2_MOUSE_EVENT_KIND_X_BUTTON_UP, then mouseData specifies which X buttons were pressed or released. This value should be 1 if the first X button is pressed/released and 2 if the second X button is pressed/released. If eventKind is COREWEBVIEW2_MOUSE_EVENT_KIND_LEAVE, then virtualKeys, mouseData, and point should all be zero. If eventKind is any other value, then mouseData should be zero. Point is expected to be in the client coordinate space of the WebView. To track mouse events that start in the WebView and can potentially move outside of the WebView and host application, calling SetCapture and ReleaseCapture is recommended. To dismiss hover popups, it is also recommended to send COREWEBVIEW2_MOUSE_EVENT_KIND_LEAVE messages. \snippet ViewComponent.cpp SendMouseInput

SendPointerInput
HRESULT SendPointerInput(COREWEBVIEW2_POINTER_EVENT_KIND eventKind, ICoreWebView2PointerInfo pointerInfo)

SendPointerInput accepts touch or pen pointer input of types defined in COREWEBVIEW2_POINTER_EVENT_KIND. Any pointer input from the system must be converted into an ICoreWebView2PointerInfo first.

add_CursorChanged
HRESULT add_CursorChanged(ICoreWebView2CursorChangedEventHandler eventHandler, EventRegistrationToken* token)

Add an event handler for the CursorChanged event. The event is raised when WebView thinks the cursor should be changed. For example, when the mouse cursor is currently the default cursor but is then moved over text, it may try to change to the IBeam cursor.

get_Cursor
HRESULT get_Cursor(HCURSOR* cursor)

The current cursor that WebView thinks it should be. The cursor should be set in WM_SETCURSOR through \::SetCursor or set on the corresponding parent/ancestor HWND of the WebView through \::SetClassLongPtr. The HCURSOR can be freed so CopyCursor/DestroyCursor is recommended to keep your own copy if you are doing more than immediately setting the cursor.

get_RootVisualTarget
HRESULT get_RootVisualTarget(IUnknown* target)

The RootVisualTarget is a visual in the hosting app's visual tree. This visual is where the WebView will connect its visual tree. The app uses this visual to position the WebView within the app. The app still needs to use the Bounds property to size the WebView. The RootVisualTarget property can be an IDCompositionVisual or a Windows::UI::Composition::ContainerVisual. WebView will connect its visual tree to the provided visual before returning from the property setter. The app needs to commit on its device setting the RootVisualTarget property. The RootVisualTarget property supports being set to nullptr to disconnect the WebView from the app's visual tree. \snippet ViewComponent.cpp SetRootVisualTarget \snippet ViewComponent.cpp BuildDCompTree

get_SystemCursorId
HRESULT get_SystemCursorId(UINT32* systemCursorId)

The current system cursor ID reported by the underlying rendering engine for WebView. For example, most of the time, when the cursor is over text, this will return the int value for IDC_IBEAM. The systemCursorId is only valid if the rendering engine reports a default Windows cursor resource value. Navigate to LoadCursorW for more details. Otherwise, if custom CSS cursors are being used, this will return 0. To actually use systemCursorId in LoadCursor or LoadImage, MAKEINTRESOURCE must be called on it first.

put_RootVisualTarget
HRESULT put_RootVisualTarget(IUnknown target)

Set the RootVisualTarget property.

remove_CursorChanged
HRESULT remove_CursorChanged(EventRegistrationToken token)

Remove an event handler previously added with add_CursorChanged.

Meta