Jump to content

Recommended Posts

Posted

Thanks @ptrex

...from what you can read on the OrdoWebView2's control description page it seems that all the necessary dependencies should be installed by OrdoWebView2ControlRedistributable.exe.

literally:

"In the "Redistributable" folder, OrdoWebView2ControlRedistributable.exe is used to install the control and its dependencies on a client machine. Launched with the /verysilent option, this program can be integrated into the installer of your own solution."

in truth at first glance I couldn't find that executable on the HD, but then I saw that it is present with a slightly different name and that is OrdoWebView2ControlRedistribuable.exe, the name ends with "...Redistribuable.exe" instead of "...Redistributable.exe", a "t" is missing in the file name.

however even manually running that file doesn't seem to solve the problem... 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted (edited)

Long time ago some posted a VB Wrapper for the controls

To run them you need to install the VB6 Controls Runtime Plus 2.2 Dependency files:

https://sourceforge.net/projects/vb6extendedruntime/

You only need this to install (not the rest !!)

image.png.aeff176402f8716935d9dc88ae27e3d2.png

Once installed you can run the included AU3 Example scripts :

image.png.f9b8eed470edb20a09193d522f08af57.png

image.png.f3b5172830ff07ee36b236f4ddb1236d.png

I guess once you have installed the VB6 runtime control you can get the Edge Wrapper to work as well...

Success

 

_VB Controls.zip

Edited by ptrex
Posted

Hi Ptrex, thanks for this post,
by installing the material you posted I was only able to run the examples contained in it, but unfortunately OrdoWebView2.ocx continues not to work.
Although the variable $oWebView2 in my script above is an object, it seems not to "contain" the reference to the Webview2 control. Probably the instantiation of WebView2 by the OCX fails ...(?)
What is strange is that the example program Test.exe included in the directory \OrdoWebView2Control\ which also contains OrdoWebView2.ocx works regularly, therefore all the "dependencies" that are needed should already be present.
In addition, in this post (https://www.vbforums.com/showthread.php?899415-OrdoWebview2-ActiveX-WebView2-Browser-Control-(Replacement-of-the-MS-browser-control)&p=5651133&viewfull=1#post5651133) on the site "vbforums", it is written which are the essential files for the OrdoWebView2.ocx control to work.
What a pity that there are always problems in getting something to work. 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

@Gianni

Apparently if you read through the documentation there are more dependencies needed ...

https://www.vbforums.com/showthread.php?899415-OrdoWebview2-ActiveX-WebView2-Browser-Control-(Replacement-of-the-MS-browser-control)

They have built a custom vbRichClient based on the RC6, that is built with VB6 and has a few DLL's to download first

https://www.vbrichclient.com/#/en/Downloads.htm

Next you need to register a few COM components from the downloaded DLL's.

It also has to the WebView2Loader.dll in there that is needed...

For more info best go to the VB forum to see some example scripts to do some trial and error...

 

Posted (edited)

Hello friends, I haven't used AutoIt for a long time, but I always like these challenges, and I never forget you. Apparently there is some bug in how GUICtrlCreateObj works and I don't have time to look internally at the bug. This way I was able to create the instance of the object. 

 

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>



Global Const $gATL = DllOpen("ATL.DLL")
Global Const $gOleaut32 = DllOpen("oleaut32.dll")
Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")


_TestOrdoWebView()

Func _TestOrdoWebView()

    ConsoleWrite("AtlAxWinInit: " & AtlAxWinInit() & @CRLF)
    Local $pProgID = SysAllocString('OrdoWebView2.OrdoWebView')
    ConsoleWrite("SysAllocString('OrdoWebView2.OrdoWebView'): " & $pProgID & @CRLF)

    Local $hGUI = GUICreate("OrdoWebView2.OrdoWebView Test", (@DesktopWidth) / 1.2, (@DesktopHeight) / 1.2, Default, Default, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    Local $hResult = AtlAxCreateControl($pProgID, $hGUI)
    _SysFreeString($pProgID)
    Local $pIUnkown = AtlAxGetControl($hGUI)
    ConsoleWrite("AtlAxGetControl: " & $pIUnkown & @CRLF)
    GUISetState()
    Local $oOrdoWebView2 = ObjCreateInterface($pIUnkown, "{E54909AA-1705-44A9-8235-B24F74366B3F}")
    Local $oOrdoWebViewEvents = ObjEvent($oOrdoWebView2, "_OrdoWebView_", "__OrdoWebView")
    ConsoleWrite("$oOrdoWebView2: " & IsObj($oOrdoWebView2) & @CRLF)
    ConsoleWrite($oOrdoWebView2.GetWebView2Version() & @CRLF)
    ConsoleWrite($oOrdoWebView2.GetMostRecentInstallPath() & @CRLF)
    $oOrdoWebView2.Anchor = True
    $oOrdoWebView2.Search_URL = "https://search.yahoo.com/search?p=%1"
    $oOrdoWebView2.HomeURL = "http://www.google.com"
    $oOrdoWebView2.SearchEngine = 2
    $oOrdoWebView2.SearchAuto = True
    $oOrdoWebView2.Init()

    While Not $oOrdoWebView2.IsWebViewInit() ;wait initialization otherwise Navigate will fail
        Sleep(100)
    WEnd
    $oOrdoWebView2.Navigate("https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/page/9/#findComment-1542505")
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($hGUI)
EndFunc   ;==>_TestOrdoWebView


Func _OrdoWebView_InitComplete($oIEpDisp)
    ConsoleWrite("_OrdoWebView_InitComplete" & @CRLF)
EndFunc   ;==>_OrdoWebView_InitComplete

Func AtlAxCreateControl($pProgID, $HWND)
    Local $aCall = DllCall($gATL, "long", "AtlAxCreateControl", "ptr", $pProgID, "handle", $HWND, "ptr", 0, "ptr", 0)
    If @error Then Return SetError(1, 0, -1)
    Return $aCall[0]
EndFunc   ;==>AtlAxCreateControl

Func AtlAxGetControl($HWND)
    Local $aCall = DllCall($gATL, "long", "AtlAxGetControl", "handle", $HWND, "ptr*", 0)
    If @error Then Return SetError(1, 0, -1)
    Return $aCall[2]
EndFunc   ;==>AtlAxGetControl

Func AtlAxWinInit()
    Local $aCall = DllCall($gATL, "bool", "AtlAxWinInit")
    If @error Then Return SetError(1, 0, -1)
    Return $aCall[0]
EndFunc   ;==>AtlAxWinInit


Func _SysFreeString($pBSTR)
    ; Author: Prog@ndy
    If Not $pBSTR Then Return SetError(2, 0, 0)
    DllCall($gOleaut32, "none", "SysFreeString", "ptr", $pBSTR)
    If @error Then Return SetError(1, 0, 0)
EndFunc   ;==>_SysFreeString

Func SysAllocString($str)
    ; Author: monoceres
    Local $aCall = DllCall($gOleaut32, "ptr", "SysAllocString", "wstr", $str)
    If @error Then Return SetError(1, 0, 0)
    Return $aCall[0]
EndFunc   ;==>SysAllocString


; User's COM error function. Will be called if COM error occurs
Func _ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

 

 

Saludos

Edited by Danyfirex
Edited. Some Author where wrong
Posted

Hi @Danyfirex, thank you so much for this script!
Now I have put in the same directory as your script the folder \OrdoRC6 and the file OrdoWebView2.ocx (I also registered OrdoWebView2.ocx with the command "regsvr32 OrdoWebView2.ocx" from an admin prompt) and everything works like a charm.
Thanks again for this "Easter gift" I will play with it in the next days. 
You are great! :)

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...