... a little digression from the OP
Browsing the internet I came across this interesting page (https://freeware.ordoconcept.net/OrdoWebview2.php) where there is an ocx through which it should be possible to use WebView2. Actually it refers to VB6, but maybe it can be adapted here too? To test it I installed OrdoWebView2 SDK (https://freeware.ordoconcept.net/download.php?file=OrdoWebView2ActiveXControl.2.0.9.exe). I then tried to use it through this simple script which is an adaptation of a similar script by @ptrex taken from this link, but I receive an error from the ocx: "Run-time error '0'"; the methods are not executed and not even the browser is incorporated into the GUI. Does anyone know how and if it is possible to make it work here? thanks.
#AutoIt3Wrapper_UseX64=N
#include <GUIConstantsEx.au3>
; Initialize COM error handler
$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
; Load ActiveX module
$hActiveX = DllOpen("C:\Windows\SysWOW64\OrdoWebView2.ocx")
; Object identifiers
Global Const $sCLSID = "{56335193-C129-41AC-B94A-B26B9B7469CF}" ; retrieved from the registry
Global Const $sIID = Default
; Create a simple GUI for our output
Local $hWebView2 = GUICreate("WebView2 ocx test", 1000, 580, (@DesktopWidth - 1000) / 2, (@DesktopHeight - 580) / 2)
GUISetState(@SW_SHOW) ;Show GUI
; Create Com Object
; Local $oWebView2 = ObjCreate("OrdoWebView2.OrdoWebView") ; HEXEDIT.HexEditCtrl.1")
Local $oWebView2 = ObjCreate($sCLSID, $sIID, $hActiveX)
If IsObj($oWebView2) Then
MsgBox(64, "Object's info", _
"Name of Object is:...." & ObjName($oWebView2, 1) & @CRLF & _
"Description string is:.........." & ObjName($oWebView2, 2) & @CRLF & _
"ProgID is:......................" & ObjName($oWebView2, 3) & @CRLF & _
"File associated in Registry is:." & ObjName($oWebView2, 4) & @CRLF & _
"Module name in which runs is:..." & ObjName($oWebView2, 5) & @CRLF & _
"CLSID of object's coclass is:..." & ObjName($oWebView2, 6) & @CRLF & _
"IID of object's interface is:..." & ObjName($oWebView2, 7))
Else
Exit MsgBox(16, '', "Error occurred")
EndIf
; https://freeware.ordoconcept.net/Help/OrdoWebView2/
$oWebView2.Anchor = True
$oWebView2.HomeURL = "https://www.google.com/"
$oWebView2.SearchEngine = 'Google'
$oWebView2.Init
$GUIActiveX = GUICtrlCreateObj($oWebView2, 10, 10, ((@DesktopWidth - 1000) / 2) - 20, ((@DesktopHeight - 580) / 2)) - 20)
; GUICtrlSetResizing($GUIActiveX, $GUI_DOCKAUTO)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
; COM Error Handler
Func MyErrFunc()
$HexNumber = Hex($oMyError.number, 8)
MsgBox(0, "AutoItCOM", "We intercepted a COM Error !" & @CRLF & @CRLF & _
"err.description is: " & @TAB & $oMyError.description & @CRLF & _
"err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _
"err.number is: " & @TAB & $HexNumber & @CRLF & _
"err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _
"err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _
"err.source is: " & @TAB & $oMyError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _
"err.helpcontext is: " & @TAB & $oMyError.helpcontext)
SetError(1)
EndFunc ;==>MyErrFunc