Results 1 to 4 of 4

Thread: Edge Webview2 Automatic installation, detect the installed version

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,621

    Edge Webview2 Automatic installation, detect the installed version

    Code:
    Function CheckSetupOk() As Boolean
        'It takes 10 seconds to check whether the edge runtime component is installed successfully. Is there a faster method?
        Dim WV As cWebView2
        Set WV = New_c.WebView2
        CheckSetupOk = WV.BindTo(Me.hWnd) <> 0
        Set WV = Nothing
    End Function
    
    Function DonwSetupTool() As Boolean
    Dim URL As String
    URL = "https://go.microsoft.com/fwlink/p/?LinkId=2124703"
    'xmlhttp download***
    'save as :Edge_Webview2RunTime.exe
    
    Dim Size1 As Long
    Size1 = FileLen(App.Path & "\Edge_Webview2RunTime.exe")
    DonwSetupTool = Size1 > 1024 ^ 2
    
    end function
    install used 32 seconds, occupying 444mb of hard disk space
    I donít know if there is a silent installation parameter to prevent him from displaying the download and installation interface

    MicrosoftEdgeWebview2Setup.exe /silent /install

    check Registry information:
    Microsoft Edge WebView2 Runtim(92.0.902.8)
    HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}
    get string value(PV and name)

    Can be used with:VB6 WebView2-Binding (Edge-Chromium)-VBForums
    https://www.vbforums.com/showthread....Edge-Chromium)
    Last edited by xiaoyao; Aug 31st, 2021 at 10:17 PM.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,621

    Re: Edge Webview2 Automatic installation, detect the installed version

    check Registry information:

    Code:
    Function GetEdgeWebViewInfo(Optional CheckX64 As String  ) As String
        On Error Resume Next
        Dim WshShell, bKey
        Set WshShell = CreateObject("Wscript.Shell")
        Dim WebView2_Version As String, WebView2_Name As String
     If CheckX64 <> "" Then CheckX64 = CheckX64 & "\"
        
        WebView2_Name = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\" & CheckX64 & "Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}\name")
        WebView2_Version = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\" & CheckX64 & "Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}\PV")
        If WebView2_Version <> "" Then GetEdgeWebViewInfo = WebView2_Name & "(" & WebView2_Version & ")"
    End Function
    in x64 operating systems,use GetEdgeWebViewInfo("WOW6432Node")
    Use in 32-bit operating systems :GetEdgeWebViewInfo("")
    Last edited by xiaoyao; Aug 31st, 2021 at 10:40 PM.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,621

    Re: Edge Webview2 Automatic installation, detect the installed version

    Code:
    Function DonwSetupTool() As Boolean
    On Error Resume Next
        Dim Url As String
        On Error Resume Next
        Url = "https://go.microsoft.com/fwlink/p/?LinkId=2124703"
        DonwSetupTool = SaveFileFromURL(Url, App.Path & "\Edge_Webview2RunTime.exe")
        If DonwSetupTool Then
            Dim Size1 As Long
            Size1 = FileLen(App.Path & "\Edge_Webview2RunTime.exe")
            DonwSetupTool = Size1 > 1024 ^ 2
        End If
    End Function
    
    Function SaveFileFromURL(Url1 As String, filePath As String)
    On Error Resume Next
        Dim FileNum As Long
        Dim FileData() As Byte
        Dim WHTTP As Object
        Set WHTTP = CreateObject("WinHTTP.WinHTTPrequest.5.1")
        WHTTP.Open "GET", Url1, False
        'WHTTP.SetCredentials myuser, mypass, HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
        WHTTP.send
        FileData = WHTTP.responseBody
        Set WHTTP = Nothing
        FileNum = FreeFile
        Open filePath For Binary Access Write As #FileNum
            Put #FileNum, 1, FileData
        Close #FileNum
        Set WHTTP = Nothing
        SaveFileFromURL = err.Number = 0
    End Function

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2020
    Posts
    1,621

    Re: Edge Webview2 Automatic installation, detect the installed version

    The Microsoft provides a fixed webview2 runtime download link, which is a good idea.But as with previous SDK downloads, many links will disappear. Several years should download the connection not to be able to be invalid, may also upload own mirror image.

    This small automated installer can also automatically detect different operating systems.

    It took more than ten seconds to detect whether webview2 was installed.So we found a way to use the registry detection.
    The new computer checks the registry first and installs it automatically if it doesn't have one.

    After the installation is completed, check whether the webview object can be loaded successfully.


    Then I thought, is there a way to install it automatically? So with this article, step by step learning. Sum Up Experienc

    The automatic installation process also takes 30 to 50 seconds, which is a long time.

    MySQL ODBC driver, the automatic installation of this program, a few milliseconds to complete, this is very fast.He also has a silent installation method.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width