Page 1 of 12 123411 ... LastLast
Results 1 to 40 of 480

Thread: VB6 WebView2-Binding (Edge-Chromium)

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    VB6 WebView2-Binding (Edge-Chromium)

    Have just finished a Binding to the new WebView2-BrowserControl (based on Edge-Chromium).

    I've included this Binding (all in a single Class, named cWebView2) in the new RC6-version of the RichClient-lib
    (please download this new version 6 from its usual place, at vbRichClient.com first).

    The new BaseDll-package of the RC6 now includes the official WebView2Loader.dll (version 1.0.674),
    which the cWebView2-class then works against.

    Please note, that the above Binding will currently require, that you install the larger:
    "Evergreeen WebView2-Runtime" (not included in the RC6-BasePackage).
    Here the official MS-DownloadLink for the evergreen-installer: https://go.microsoft.com/fwlink/p/?LinkId=2124703

    So, after ensuring the mentioned two prerequisites:
    - the Dlls of the new RC6-package in a folder of your choice + a registered RC6.dll
    - and the successfull installation of the "evergreen-WebView2-runtime" via the MS-download-link above

    You should now be able to test this new Edge-Browser-Binding (even on Win7-OSes) via this little VB6-Demo:
    WebView2Demo.zip

    Please let me know, when something is not working as expected -
    or when you want me to include a certain extra-functionality into the new cWebView2-class.

    I want to "finalize" the new RC6-functionality at the end of the year (then switching Binary-Compatibility on).

    Happy testing...

    Olaf

  2. #2
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,742

    Re: VB6 WebView2-Binding (Edge-Chromium)

    VERY GOOD,HOW TO get web page cookie? so i can use winhttp or xmlhttp to download URL
    OR WebView2Loader.dll WILL have a method for download url,post data?

  3. #3
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,742

    Re: VB6 WebView2-Binding (Edge-Chromium)

    CodeName=Mozilla
    MinorVersion=undefined
    Name=Netscape
    Version=5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 Edg/86.0.622.58
    CookieEnabled=true

    how to test web page,its chrome or ie?
    https://www.w3school.com.cn/tiy/t.asp?f=hdom_navigator

  4. #4
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,742

    Re: VB6 WebView2-Binding (Edge-Chromium)

    HOW TO RUN JS CALL BY WEB page like :var a=btn1_click(22,33)?
    i want to call vb sub from js,and back the value to js

    Code:
        WV.AddScriptToExecuteOnDocumentCreated "function btn1_click(msg1,msg2){ vbH().RaiseMessageEvent('btn1_click',msg1+','+msg2) }"
    
    WV.NavigateToString "<!DOCTYPE 
    
    html><html><head><title>AppTitle</title></head><body>" & 
    
    _
                              "<div>Hello World...</div>" & _
                              "<input id='txt1' value='foo'>" & _
                              "<button id='btn1' onclick='btn1_click(22,33)' 
    
    >Button1</button>" & _
                          "</body></html>"
    Private Sub WV_JSMessage(ByVal sMsg As String, ByVal 
    
    sMsgContent As String, oJSONContent As cCollection)
    sMsgContent=22,33
    Last edited by xiaoyao; Nov 2nd, 2020 at 09:21 AM.

  5. #5
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: VB6 WebView2-Binding (Edge-Chromium)

    (From dm)

    I tested WebView2Demo and it's great. I have some questions:

    (1) Could you add IndexByItem to RC6.cCollection?

    (2) Can WebView.CapturePreview capture the entire Web page, not just the visible part of the window?

    (3) Could you demonstrate the drag operations of WebView, for example: Drag a button or grid from the VB6-Form to WebView, and WebView will generate a Html-Button or a Html-Table in the Web page. Similar to the following: https://www.layoutit.com/build

    (4) Can V8 be integrated into RC6?

    (5) If V8 is too large, can RC6 integrate a small embedded JavaScript engine similar to QuickJS or MuJS?

    (6) When we use VB6 to develop commercial controls, .NET developers are not willing to use VB6 controls, they prefer to use .NET controls. When we use VB6 to develop commercial software, our commercial software can only run on the Windows platform, while our competitors' products can run on multiple platforms (Windows, Web, Android, iOS). In other words, we don't know what we can do with VB6 now? If RC6 could help developers in cross-platform, it would be a very wonderful thing.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by xiaoyao View Post
    HOW TO get web page cookie?
    The WebView2-interfaces do not include (other than the old, IE-based WebControl)
    a COM-Wrapper-ObjectModel for interaction with the DOM of a loaded document.

    So, all the interaction with a currently loaded DOM has to happen via JavaScript.
    That's the reason, why:
    - jsProp(...)
    - jsRun(...)
    - jsRunAsync(...)
    are included as Methods behind the WV-variable (of type cWebView2).

    And in case of Cookies, that means, you will have to address them via the appropriate js-expression like this:
    Code:
    'enhance the Forms WebView-EventHandler below about an additional line, to read a given documents cookies
    'when pressing the < Navigate to google.com > Button, you should see the cookies which were set from the Google-Server.
    Private Sub WV_DocumentComplete()
      Debug.Print "WV_DocumentComplete"
      Debug.Print WV.jsProp("document.cookie")
    End Sub
    As for your BrowserVersion-String - the one you've posted:
    ...Version=5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36 Edg/86.0.622.58
    does contain a "Chromium-Version-Part" and an "Edge-Version-Part" as well... (so it's definitely not IE-based)

    Olaf

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by SearchingDataOnly View Post
    (1) Could you add IndexByItem to RC6.cCollection?
    This is already implemented (via Optional ByRef Param: FoundItemIndex) in the cCollection.ItemExists(...) method.

    Quote Originally Posted by SearchingDataOnly View Post
    (2) Can WebView.CapturePreview capture the entire Web page, not just the visible part of the window?
    One could determine (via JavaScript) the "total Height in Pixels" a Document would fit into
    (whilst having a certain PixelWidth) - and then manually resize the WebView (via WV.Movexxx) temporarily,
    and then call the Capture-Method.

    But this feature-request came up also in the "Issue-tracker" IIRC, so I'd like to wait for the official release.

    Quote Originally Posted by SearchingDataOnly View Post
    (3) Could you demonstrate the drag operations of WebView, for example: Drag a button or grid from the VB6-Form to WebView, and WebView will generate a Html-Button or a Html-Table in the Web page. Similar to the following: https://www.layoutit.com/build
    As already statet, one has to incorporate ones own js-snippets into the WebView2-Control,
    to address such actions.
    As e.g. shown here: https://www.w3schools.com/html/html5_draganddrop.asp

    Quote Originally Posted by SearchingDataOnly View Post
    (4) Can V8 be integrated into RC6?
    With the WebView2-Binding, one already has access to the V8-js-engine (it is included via Chromium within this new Edge-based Control).

    Quote Originally Posted by SearchingDataOnly View Post
    (5) If V8 is too large, can RC6 integrate a small embedded JavaScript engine similar to QuickJS or MuJS?
    I'd think that JScript9 (via cActiveScript) is already a "small and relatively fast" js-Engine one can use -
    and as said, for V8-support, one can use the WebView2 (e.g. hosted-in/bound-to an invisible PicBox).

    Quote Originally Posted by SearchingDataOnly View Post
    (6) When we use VB6 to develop commercial controls, .NET developers are not willing to use VB6 controls, they prefer to use .NET controls. When we use VB6 to develop commercial software, our commercial software can only run on the Windows platform, while our competitors' products can run on multiple platforms (Windows, Web, Android, iOS). In other words, we don't know what we can do with VB6 now? If RC6 could help developers in cross-platform, it would be a very wonderful thing.
    That depends on, when a VB6-compatible compiler becomes available.
    My spare-time is not sufficient, to drive this side-project of mine along in a decent pace currently.

    Meanwhile others might come up with "something promising" in this regard -
    but the timeframe will in either case be measured in years, not months.

    Olaf

  8. #8
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    439

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hi Olaf, I couldn't make it run

    Err Number -2147221164 Clase no registrada

    Set WV = New_c.WebView2 'create the instance

    what am I doing wrong?
    i think i can't register rc6.dll, but if i can load it to project
    leandroascierto.com Visual Basic 6 projects

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by LeandroA View Post
    what am I doing wrong?
    i think i can't register rc6.dll, but if i can load it to project
    I think, that's what you need to resolve first.
    Just loading the typelib of the RC6 (semiautomatically... via the VB6-IDE),
    will not be enough (on a developer-machine).

    You'll have to:
    - keep any of the Dlls of the RC6-BasePackage-Dlls "in one place" (a single Folder you copy them to, as e.g. C:\RC6\)
    - and then "deep-register" the RC6.dll there either via the included VBScript or via an Admin-Console calling regsvr32 behind the SysWow64 folder

    HTH

    Olaf

  10. #10
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: VB6 WebView2-Binding (Edge-Chromium)

    (From dm)

    Quote Originally Posted by Schmidt View Post
    This is already implemented (via Optional ByRef Param: FoundItemIndex) in the cCollection.ItemExists(...) method.
    Yes, in many cases, cCollection.ItemExists and FoundItemIndex are more convenient. But IndexByItem is more concise and intuitive, it's very necessary to add IndexByItem to cCollection.

    Quote Originally Posted by Schmidt View Post
    I'd think that JScript9 (via cActiveScript) is already a "small and relatively fast" js-Engine one can use -
    and as said, for V8-support, one can use the WebView2 (e.g. hosted-in/bound-to an invisible PicBox).
    cActiveScript does not seem to support some of the latest JS syntax and the latest RE parameters.

    Quote Originally Posted by Schmidt View Post
    That depends on, when a VB6-compatible compiler becomes available.
    My spare-time is not sufficient, to drive this side-project of mine along in a decent pace currently.
    If a programming language wants to gain long-term vitality, it must have good commercial value, so as to form a stable software ecological chain around this programming language. If RC5/RC6 users can develop some valuable commercial software around RC6, then you will have more resources (funds and teams) to speed up the development of VB6-compatible compiler. I don't know if you have had such a plan.

    I can develop some good commercial software with VB6 and RC5/RC6, but the problem is that if a commercial software can only run in a Windows environment, its market demand and market share will be very low. Such softwares cannot form a solid software ecological chain, nor can they provide you with more resources.

    Quote Originally Posted by Schmidt View Post
    Meanwhile others might come up with "something promising" in this regard -
    but the timeframe will in either case be measured in years, not months.
    A few years is too long.
    I'm thinking, if we develop a scripting language compatible with the syntax of the BASIC language, and then develop a scripting language runtime environment similar to NodeJS. Is it possible to realize a VB6-like programming language that can be cross-platform? Of course, this scripting language must have a visual IDE similar to VB6.
    Last edited by SearchingDataOnly; Nov 3rd, 2020 at 12:18 PM.

  11. #11
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,854

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Check RadBasic, Mercury VB, B4X
    But this has nothing to do with this code submission

  12. #12
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,094

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by SearchingDataOnly View Post
    A few years is too long..
    Like everyhting in life a new VB compiler will take enough time, patience and disposable income. Judging by the expressed lack of time *and* obvious lack of patience you must be in posession of a lot of disposable income.

    Is there something that interested parties must know here?

    cheers,
    </wqw>

  13. #13
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: VB6 WebView2-Binding (Edge-Chromium)

    A small question about WebView2Demo:

    After starting the computer, when opening WebView2Demo.exe or WebView2Demo.vbp for the first time, the system prompts "couldn't initialize Webview-Bingding". After closing the window and re-opening WebView2Demo.exe or WebView2Demo.vbp, the system runs normally.

    In other words, every time the computer is restarted, the first initialization (WV.BindTo) always fails, and the second time is normal.

    In addition, how does IE-WebBrowser achieve a function similar to WebView2.CapturePreview?

    (OS: Win10)

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by SearchingDataOnly View Post
    ...every time the computer is restarted, the first initialization (WV.BindTo) always fails, and the second time is normal.
    The BindTo (as well as the two Navigate-Methods) have a second (optional)TimeOutSeconds-Parameter -
    by default sitting at 5 seconds.

    I guess your system is (shortly after booting) still quite busy with delayed loading of other base-stuff like services etc. -
    in addition to loading the quite large Chromium-Runtime, ... so the default of 5sec may be a bit too short -
    (I can imagine, that older magnetic disks might play a role, because I see no larger delay here on my test-OSes on SSDs).

    You could:
    - either try to increase that TimeOut-Param (to maybe 10sec or so)
    - or set it to Zero, to tell the methods to wait for their matching EventHandlers
    .. (WV_InitComplete or WV_NavigationCompleted respectively, to proceed with your own, now async Inits from within those Handlers)

    Quote Originally Posted by SearchingDataOnly View Post
    In addition, how does IE-WebBrowser achieve a function similar to WebView2.CapturePreview?
    You still planning on using the IE further???

    Well, there's an IHTMLPainter interface one can cast to (IIRC, from an IHTMLWindow2), which offers a Draw-method.
    There's also PrintPreview-interfaces which allow capturing of one (or more) pages.
    And of course you could try to work via API-calls directly on the hWnd of that Control, to copy its current Render-Output.

    Perhaps there's also some stuff hidden in all those IE-OleCmdID-EnumValues which might accomplish a Preview- or Capture-output.

    Olaf

  15. #15
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post
    The BindTo (as well as the two Navigate-Methods) have a second (optional)TimeOutSeconds-Parameter -
    by default sitting at 5 seconds.

    I guess your system is (shortly after booting) still quite busy with delayed loading of other base-stuff like services etc. -
    in addition to loading the quite large Chromium-Runtime, ... so the default of 5sec may be a bit too short -
    (I can imagine, that older magnetic disks might play a role, because I see no larger delay here on my test-OSes on SSDs).

    You could:
    - either try to increase that TimeOut-Param (to maybe 10sec or so)
    - or set it to Zero, to tell the methods to wait for their matching EventHandlers
    .. (WV_InitComplete or WV_NavigationCompleted respectively, to proceed with your own, now async Inits from within those Handlers)
    Yes, after changing SecondsToWaitForInitComplete from 5 to 10, the problem was solved. Thank you very much.

    Quote Originally Posted by Schmidt View Post
    You still planning on using the IE further???
    I plan to gradually replace IE with WebView2 in the next period of time, but it will take some time. During this period, IE and WebView2 will exist in my system at the same time.

    Quote Originally Posted by Schmidt View Post
    Well, there's an IHTMLPainter interface one can cast to (IIRC, from an IHTMLWindow2), which offers a Draw-method.
    There's also PrintPreview-interfaces which allow capturing of one (or more) pages.
    Ok. I will try this method.

    Quote Originally Posted by Schmidt View Post
    And of course you could try to work via API-calls directly on the hWnd of that Control, to copy its current Render-Output.
    Yes, I know this way. I can use SendMessage(...WM_PRINT...) to capture IE Preview.

    In addition, my current project is almost finished. In a few months, I will start to develop a scripting language and IDE similar to VB6 (of course, the development time is also calculated in years). If you could provide some good seeds (prototypes or suggestions), maybe I can develop a decent scripting language and IDE, and this IDE may be applied to your VB6-compatible compiler.

    (From dm)
    Last edited by SearchingDataOnly; Nov 8th, 2020 at 05:47 AM.

  16. #16
    Lively Member
    Join Date
    Aug 2016
    Posts
    112

    Re: VB6 WebView2-Binding (Edge-Chromium)

    This came as a surprise.

    Olaf, we can't thank you enough for your contribution.

    I haven't tested it yet but I am already thrilled.

    This is something I have been searching for for a long time.

  17. #17
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hello Olaf
    Fantastic job! I dreamed about it for many months and you did it, fabulous!


    Is there a way to force the localization of the cWebView2 component? On my computer, the sub menus are still in English despite an installation on a French Windows 10!


    The only way I have found to solve this problem is to destroy the EN-US.pak file in the Locales folder of the EdgeWebView installation and rename fr.pak to EN-US.pak! It works but it is not very clean!


    Do you have an idea ?


    Many Thanks

  18. #18

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by saturnian View Post
    Is there a way to force the localization of the cWebView2 component?
    On my computer, the sub menus are still in English despite an installation on a French Windows 10!
    Ah, yes... sorry.

    Forgot to reset my internal Lang-Handling "to normal" (it was still hardwired to "en" for my own tests) ...
    (fixed that just now, so the next RC6-version will start with the default-language of the current system again, regarding Popup-Menus and other localizations).

    But (regarding a workaround, applied to the version you currently have...) -
    there's always the last (optional) Param in the BindTo-method, which can "influence everything" (config-wise).

    BackGround:
    This last param (additionalBrowserArguments) can take up (and later represents) the commandline-args,
    which are passed to the Chromium-Process which gets started under the covers for every WebView.

    So, a simple change of the BindTo-line (passing an appropriate cmd-string):
    If WV.BindTo(picWV.hWnd, , , , "--lang=fr") = 0 Then ...
    or (for the chinese readers here, because it might not be obvious)
    If WV.BindTo(picWV.hWnd, , , , "--lang=zh-cn") = 0 Then ...
    ...should do it for you (until the next RC6-version, where - as said - the current locale will determine the default again).

    As for the list of available commandline-switches - it is quite a long one (but described for example here):
    https://peter.sh/experiments/chromiu...line-switches/

    HTH

    Olaf

  19. #19
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    thank you so much, Olaf

  20. #20
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Another question, Olaf!
    Is there a way to intercept the URL when opening a new window after clicking on the "Open in new tab" submenu?
    This would allow programming the display of the new page in a new cWebView2

  21. #21
    New Member
    Join Date
    Nov 2020
    Posts
    6

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Thanks Olaf, this is really superb work. My VB6 app can finally be HTML5 compatible.

  22. #22

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by saturnian View Post
    Another question, Olaf!
    Is there a way to intercept the URL when opening a new window after clicking on the "Open in new tab" submenu?
    This would allow programming the display of the new page in a new cWebView2
    Right, the old Param-amount in that Event was only allowing "suppression of the built-in NewWindow-Handling"
    (though did not give much info about "what to construct, in case one wants to create his own thing").

    So, this Event was enhanced in the new version 6.0.2, which I've just uploaded to the usual place...

    A Test-Handler for the original demo (showing the new incoming Event-Args) is the following one:
    Code:
    Private Sub WV_NewWindowRequested(ByVal IsUserInitiated As Long, IsHandled As Long, ByVal URI As String, NewWindowFeatures As RC6.cCollection)
      Debug.Print "URI: "; URI
      
      Dim i As Long 'Print out, what's sitting behind the NewWindowFeatures JSON-Collection
      For i = 0 To NewWindowFeatures.Count - 1
        Debug.Print NewWindowFeatures.KeyByIndex(i), NewWindowFeatures.ItemByIndex(i)
      Next
      
      IsHandled = 1 'prevent the WebView from "doing its own thing" about the new window
    End Sub
    HTH

    Olaf

  23. #23
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Thanks, Olaf! It works perfectly

  24. #24
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,742

    Re: VB6 WebView2-Binding (Edge-Chromium)

    can you make a dll only support cWebView2?(Like 100kb?)
    how to call WebView2Loader.dll without rc6.dll?
    RC6.dll is too larger ,4MB.

  25. #25
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,742

    Re: VB6 WebView2-Binding (Edge-Chromium)

    V8Engine.dll 1.34Mb, BY 2018
    stdcall OR CDECL,Quickjs also is good for test

    can test fastdb.dll for vb6?
    a memory db lib
    Last edited by xiaoyao; May 19th, 2023 at 12:16 PM.

  26. #26
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hello Olaf
    If I am using WebView2-BrowserControl on an MDIChild window, I have some issues.
    For example, the DocumentComplete event is not fired and the component is very slow
    What is the problem ? Do you have an idea ?

    François

  27. #27

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by xiaoyao View Post
    ... can you make a dll only support cWebView2?(Like 100kb?)
    I could, but I won't...
    It doesn't make much sense to save 1 or 2 MB in deployment-size, when "the other needed part" -
    (the "evergreen WebView-runtime" from MS) is about 50MB already.

    Quote Originally Posted by xiaoyao View Post
    ... how to call WebView2Loader.dll without rc6.dll?
    Basically by writing your own binding:
    - first, by reworking the SDKs WebView2.tlb (making its COM-interfaces more "VB-friendly")
    - and then writing your own wrapper-class against the interfaces of this typelib (without exposing the typelib-types on the VB6-Class-interface)
    - the finally resulting VB6-Class then usually placed within your own VB6-AX-Dll, to avoid separate delivery of the WebView2.tlb

    Quote Originally Posted by xiaoyao View Post
    RC6.dll is too large ... 4MB.
    The current deployment-size of the RC6 is about:
    - 3.4MB (in a *.zip archive ... with current inet-speeds, downloadable in about 0.3 seconds)
    - 2.5MB (in a *.7z archive ... with current inet-speeds, downloadable in about 0.2 seconds)

    And that makes it the smallest "DB- and GUI-including" Desktop-App-Framework on the planet ...
    (it is significantly smaller than e.g. GTK3, QT, Electron or "Avalonia+.NET-Core5")

    For most "non Hello-World-Apps" (which do something useful), you will have to deploy "a set of Dlls/OCXes alongside your Exe" anyways.

    So, when you develop and later deploy your App based on a dozen of smaller libs (Dlls and OCXes) - this will sum up to typically:
    - about 2-4MB in your deployment-zip (or perhaps 5-8MB, when you include Icon+ Image-Resources and maybe a Font or two).

    So no, I cannot see where the big "burden" from introducing the RC6 will come in
    (which would allow you, to replace most of your other COM-dependencies with a single one in your App).

    Olaf

  28. #28

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by saturnian View Post
    Hello Olaf
    If I am using WebView2-BrowserControl on an MDIChild window, I have some issues.
    For example, the DocumentComplete event is not fired and the component is very slow
    What is the problem ? Do you have an idea ?
    What OS is that scenario running on?
    And could you post a little "mockup.zip" which includes the basic-setup (with the MDI-ChildWindows and the Bindings on them) -
    and which would allow me to reproduce what you've seen?

    Another related question would be...
    If you change from "MDIChildWindow-hosting" to "normal Forms + PictureBoxes" (maybe behind a "tabbed interface") -
    do you see differences in behaviour (when running against the same http-server, using the same HTML5-inputs)?

    If yes, then it might be something related to the VB6 MDIChildWindow-class (and its slightly "off-standard" message-pumping/handling underneath)...

    Olaf

  29. #29

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by xiaoyao View Post
    V8Engine.dll 1.34M, BY 2018
    stdcall OR CDECL,Quickjs also is good for test
    As already stated in my reply to dreammanor (dm) here:
    You can already make use of "V8" via the WebView2-Binding
    (which will then include a proper "window-object" for your V8-scripts already).

    Quote Originally Posted by xiaoyao View Post
    can test fastdb.dll for vb6?
    a memory db lib
    I've already done such a test-comparison (in a former reply to you).
    And the result was, that the RC5/RC6-wrapper for SQLite performs better than "fastdb".

    In-Memory-DB scenarios are possible via SQLite as well:
    - either via the "normal" cConnection-SQLite-wrapper Class in "::memory::"-Mode
    - or via the cMemDB-class (which offers a few more convenience-functions on top of cConnection)

    Olaf

  30. #30
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    I found !
    I have misused the properties of cWebview!


    'WV.AreDefaultContextMenusEnabled = True
    'WV.AreDefaultScriptDialogsEnabled = True
    'WV.AreDevToolsEnabled = True
    'WV.AreHostObjectsAllowed = True
    'WV.IsScriptEnabled = True
    'WV.IsWebMessageEnabled = True

    WV.IsStatusBarEnabled = True


    If I uncomment this whole block of code, it doesn't work! Otherwise everything works fine (just with WV.IsStatusBarEnabled = True )

  31. #31

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by saturnian View Post
    I found !
    I have misused the properties of cWebview!


    'WV.AreDefaultContextMenusEnabled = True
    'WV.AreDefaultScriptDialogsEnabled = True
    'WV.AreDevToolsEnabled = True
    'WV.AreHostObjectsAllowed = True
    'WV.IsScriptEnabled = True
    'WV.IsWebMessageEnabled = True

    WV.IsStatusBarEnabled = True


    If I uncomment this whole block of code, it doesn't work! Otherwise everything works fine (just with WV.IsStatusBarEnabled = True )
    That's a bit surprising, because all of these Props are (by default, after initialization) already "On" (at C++ Boolean-Value = 1).

    What you should keep in mind though is, that I've implemented these Boolean-Props "As Long"
    (to directly map between the C++ Boolean prop-calls and the Wrapper-Props).

    So, what gets passed along (into the C++ iplementation of the WebView) in your example above,
    are (due to VBs automatic Type-coercing) "Long-Values which are -1" (coerced from VB6-True).

    So these "-1" Values you pass (in a 32Bit-slot, having all bits at 1) might confuse the C++-code (although, normally this should not be an issue).

    That said, ... testing.... and arrrghhh...
    Whilst checking this in the little Demo-App of the opener thread (placing your calls after the BindCall),
    you are right indeed - the True Values (transported as -1 Longs) confuse the WebView2 here as well... (every Prop-setting-line being active)

    But good news... I have no issues when changing "all the True's" to the C++ Value 1:
    Code:
    Private Sub Form_Load()
      ...
    
      If WV.BindTo(picWV.hWnd) = 0 Then MsgBox "couldn't initialize WebView-Binding": Exit Sub
      Debug.Print WV.GetMostRecentInstallPath
     
      WV.AreDefaultContextMenusEnabled = 1
      WV.AreDefaultScriptDialogsEnabled = 1
      WV.AreDevToolsEnabled = 1
      WV.AreHostObjectsAllowed = 1
      WV.IsScriptEnabled = 1
      WV.IsWebMessageEnabled = 1
      WV.IsStatusBarEnabled = 1
    
      LocalWebViewInit 'initialize the WebView for local usage here in our Form
    End Sub
    Ok then, please expect the next RC6 version to have proper VB6-Boolean types on all the relevant Config-Props.
    (which I will then take care of internally, mapping them to the correct C++ Boolean-Type).

    So, thanks for your testing, which made this behaviour apparent in this still "early stage"
    (where the RC6-interfaces for its new Class-Additions are not yet "finalized").

    Olaf

  32. #32
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,742

    Re: VB6 WebView2-Binding (Edge-Chromium)

    by vfb maybe no need rc6.dll,WebView2Loader.dll
    it'S like vc++

  33. #33
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post
    So, thanks for your testing, which made this behaviour apparent in this still "early stage"
    (where the RC6-interfaces for its new Class-Additions are not yet "finalized").

    Olaf
    This is nothing compared to the fabulous work you do for the community !
    Thanks again, Olaf


    To test, I wrote a multi-tab browser, which begins to work well.
    I realized that it was necessary to avoid giving the focus to another control, in the NavigationCompleted event. If you want to modify a display based on an error number, for example, it is better to do so by activating a timer which will trigger the display late.

    Other thing : the URLs "chrome://flags", "chrome://history", "chrome://downloads",... work but do not trigger the DocumentComplete event, which sometimes causes the Webview component to lag for several tens of seconds! I don't know why !

    Sincerely

    François

  34. #34

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,207

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by saturnian View Post
    Other thing : the URLs "chrome://flags", "chrome://history", "chrome://downloads",... work but do not trigger the DocumentComplete event, which sometimes causes the Webview component to lag for several tens of seconds! I don't know why !
    Perhaps these "internal URLs" do not really "manifest" themselves in a true document...
    Did you try to use the NavigationCompleted-event for these URLs instead?

    Olaf

  35. #35
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: VB6 WebView2-Binding (Edge-Chromium)

    (From dm)

    I've bound WebView to cwMyWidget and it works very well. Now I have two questions:
    (1) How to add my own right-click menu to WebView?
    (2) Is it possible to bind IE-WebBrowser-Control (Shell.Explorer.2) to cWidgetBase or cWidgetRoot? If this is possible, I can keep both WebView2 and IE-WebBrowser in my system. Thanks.

    Edit:
    The first question has been solved:
    Step1: WV.AreDefaultContextMenuEnabled = False
    Step2: WV_UserContextMenu Event
    Last edited by SearchingDataOnly; Dec 16th, 2020 at 07:20 PM.

  36. #36
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: VB6 WebView2-Binding (Edge-Chromium)

    The third question:
    (3) When using WV.Navigate to open an html file, everything is OK. The external css files and js files in the html file can be accessed normally. However, when using WV.NavigateToString to open an html-string, the external css files or js files contained in the html-string will not be accessible, and DevTools prompts "Not allowed to load local resource...".

    I'd like to know if there is a way to solve this problem (for example, can this problem be solved by cWebServer?). In my software, all Html operations are done through html-strings instead of html-files. In other words, I need to use WV.NavigateToString a lot instead of WV.Navigate a file. (Note: There is no such problem in IE-WebBrowser)

    In addition, after I used the parameter "--disable-web-security --allow-file-access-from-files --allow-file-access", DevTools prompts "Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME"


    Edit:
    The problem discussed in the following thread is similar to mine:
    https://github.com/MicrosoftEdge/Web...ack/issues/642

    The poster seems to have solved the problem through SetVirtualHostNameToFolderMapping, but I have not seen the SetVirtualHostNameToFolderMapping API in RC6.WebView.

    Edit 2:
    Two other links related to this issue:

    API Spec for NavigateWithWebResourceRequest
    https://github.com/MicrosoftEdge/Web...9267942e836977

    WebView.NavigateToLocalStreamUri(Uri, IUriToStreamResolver) Method
    https://docs.microsoft.com/en-us/uwp...treamResolver_
    Last edited by SearchingDataOnly; Dec 16th, 2020 at 11:30 PM.

  37. #37
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post
    Did you try to use the NavigationCompleted-event for these URLs instead?

    Olaf
    Hello Olaf


    I, of course, tried to use the NavigationCompleted event. But trying to give focus to another object in this event freezes the cWebView component for several minutes, often. I solved this by activating a timer in the NavigationCompleted event which itself, a second after, update the other objects (The form caption with the tltle of the web page, for example)

  38. #38
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Olaf


    is it possible to expose the "NavigationStarting" event in cWebView2? It seems to me that this is the only event in Microsoft's WebView2 control that is not present in cwebView2!

    Kindly
    François

  39. #39
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: VB6 WebView2-Binding (Edge-Chromium)

    The fourth question:
    (4) I need to place multiple WebViews on my Form or WidgetForm. I bind a WebView to a cwWidget through "WV.BindTo(W.Root.hWnd, 10)".
    The question is, when this cwWidget is removed, how to remove the bound WebView at the same time?
    Last edited by SearchingDataOnly; Dec 23rd, 2020 at 01:50 AM.

  40. #40
    Member
    Join Date
    Apr 2014
    Posts
    32

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Thanks a lot Olaf !
    I try a little your code last sunday and it's work well ....
    I have one question, did somebody find a way to install an Edge extension by code on the WebView2 ? Is it possible ? I beggin in this sort of developement so excuse me if my question is stupid...

    PS I dream of your webviev2 with diagrams.net (drawio-desktop)....
    Last edited by Thierry76; Feb 3rd, 2021 at 02:45 AM.

Page 1 of 12 123411 ... LastLast

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