-
Nov 1st, 2020, 08:56 AM
#1
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
-
Nov 2nd, 2020, 08:10 AM
#2
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?
-
Nov 2nd, 2020, 12:02 PM
#3
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by xiaoyao
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
-
Nov 2nd, 2020, 08:15 AM
#4
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
-
Nov 2nd, 2020, 09:10 AM
#5
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.
-
Nov 2nd, 2020, 10:03 AM
#6
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.
-
Nov 2nd, 2020, 01:30 PM
#7
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by SearchingDataOnly
(1) Could you add IndexByItem to RC6.cCollection?
This is already implemented (via Optional ByRef Param: FoundItemIndex) in the cCollection.ItemExists(...) method.
 Originally Posted by SearchingDataOnly
(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.
 Originally Posted by SearchingDataOnly
(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
 Originally Posted by SearchingDataOnly
(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).
 Originally Posted by SearchingDataOnly
(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).
 Originally Posted by SearchingDataOnly
(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
-
Nov 3rd, 2020, 12:08 PM
#8
Re: VB6 WebView2-Binding (Edge-Chromium)
(From dm)
 Originally Posted by Schmidt
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.
 Originally Posted by Schmidt
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.
 Originally Posted by Schmidt
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.
 Originally Posted by Schmidt
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.
-
Nov 4th, 2020, 12:18 PM
#9
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by SearchingDataOnly
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>
-
Apr 24th, 2024, 08:34 PM
#10
Addicted Member
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by SearchingDataOnly
(From dm)
.....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.
Not quite true. Even in 2024 - some 4 years after this post - MS Windows still dominates the desktop, especially in productivity applications. And yes, there is still a smaller-than-in-the-past but re-growing market for desktop apps on Windows. Windows has always had - and likely always will - far more available software for most any conceivable desktop purpose then MAC OS and Linux combined. And I don't even want to go down the Linux mess rabbit hole - WAY too many "Distros", WAY to much incompatibility among them etc. so Linux is best left where it shines most - the server side.
One can still build, sell and maintain good quality commercial 32-bit desktop apps with VB6. I've done it not so long ago and I plan to again. My users/customers can't tell/don't know/don't care what language their tools are written in.
And now, with twinBasic up-and-coming, it's only going to get better!
-
Apr 24th, 2024, 08:49 PM
#11
Addicted Member
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by SearchingDataOnly
(From dm)
.....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......
\
Not quite true. Even in 2024 - some 3.5 years after this post, MS Windows still dominates the desktop, especially for productivity apps. There is still a smaller-than-before but re-growing market for commercial desktop applications. Windows has always had and likely always will have a much, much wider selection of available software than MAC OS & Linux combined. And the Linux desktop mess only makes it worse i.e. WAY to many "Distros", WAY too many incompatibilities between them, endless searches for needed dependencies, etc.
One can still create, use and sell good quality commercial software with VB6. I've done it not so long ago and I plan to again. Some on this forum have also and still are.The core VB6 runtime will be supported until at least 2031 and likely beyond.
My users/customers/groupies can't tell/don't know/don't care what programming language their tools are written in. They just fire 'em up and away they go.
And with twinBasic on the playing field, its just gonna get even better .
Last edited by SomeYguy; Apr 24th, 2024 at 08:53 PM.
-
Nov 28th, 2020, 02:55 AM
#12
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.
-
Nov 28th, 2020, 09:52 AM
#13
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by xiaoyao
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).
 Originally Posted by xiaoyao
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
-
Nov 3rd, 2020, 04:34 AM
#14
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
-
Nov 3rd, 2020, 08:27 AM
#15
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by LeandroA
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
-
Nov 3rd, 2020, 02:43 PM
#16
Re: VB6 WebView2-Binding (Edge-Chromium)
Check RadBasic, Mercury VB, B4X
But this has nothing to do with this code submission
-
Nov 7th, 2020, 11:36 PM
#17
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)
-
Nov 8th, 2020, 04:36 AM
#18
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by SearchingDataOnly
...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)
 Originally Posted by SearchingDataOnly
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
-
Nov 8th, 2020, 05:42 AM
#19
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by Schmidt
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.
 Originally Posted by Schmidt
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.
 Originally Posted by Schmidt
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.
 Originally Posted by Schmidt
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.
-
Nov 10th, 2020, 09:32 PM
#20
Lively Member
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.
-
Nov 21st, 2020, 11:15 AM
#21
Lively Member
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
-
May 22nd, 2023, 11:16 PM
#22
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by saturnian
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)
I don't know how it goes now. Where can I download the preview version?
-
Nov 22nd, 2020, 04:04 AM
#23
Lively Member
Re: VB6 WebView2-Binding (Edge-Chromium)
-
Nov 22nd, 2020, 02:18 PM
#24
Lively Member
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
-
Nov 22nd, 2020, 04:55 PM
#25
New Member
Re: VB6 WebView2-Binding (Edge-Chromium)
Thanks Olaf, this is really superb work. My VB6 app can finally be HTML5 compatible.
-
Nov 22nd, 2020, 08:44 PM
#26
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by saturnian
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
-
Nov 25th, 2020, 02:11 AM
#27
Lively Member
Re: VB6 WebView2-Binding (Edge-Chromium)
Thanks, Olaf! It works perfectly
-
Nov 28th, 2020, 02:47 AM
#28
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.
-
Nov 28th, 2020, 09:22 AM
#29
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by xiaoyao
... 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.
 Originally Posted by xiaoyao
... 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
 Originally Posted by xiaoyao
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
-
Feb 7th, 2021, 12:28 PM
#30
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by Schmidt
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.
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
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
more times,i no need rc6.dll.
but i need Chromium or edge ,or miniblink (by Chromium),so if only one dll vbedgeCom.dll or stdcall_edge.dll,
i think it's best
if it's make ocx control,i think it's easy for vb user,excel vba userform
if it's support x64 like a stdcall dll,it's also can use in vfb ide FOR X64 EXE (VISUAL freebasic)
-
Feb 7th, 2021, 03:39 PM
#31
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by xiaoyao
...more times,i no need rc6.dll.
Then this thread is not for suitable for you.
<shrug/>
What's discussed here, is a Binding to the EverGreen-Runtime of the MS-Edge-Chromium-WebControl.
EverGreen meaning, that this Runtime has to be installed only once on a given Client-Machine.
After that, the regular Windows-Edge-Updates will update also this WebControls Chromium-Runtime without any further User-intervention.
So, the Client-Machine is guaranteed, to always use a WebView-Control with the latest Security- and Bug-Fixes.
This is not the case for e.g. "miniblink" - which (have just checked in their Repo) is already 2 years out of date.
Olaf
-
Sep 4th, 2021, 09:39 AM
#32
Addicted Member
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by Schmidt
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.
... .. .
Olaf
Is there a necessity that the end-user systems (where my application is installed) also should have "evergreen WebView-runtime" installed in them (if not already installed)?
Kind regards.
-
Sep 4th, 2021, 11:21 AM
#33
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by softv
Is there a necessity that the end-user systems (where my application is installed) also should have "evergreen WebView-runtime" installed in them (if not already installed)?
Yes, of course - but on each of the target-systems, this "base-runtime-installation" will only have to be done once
(as the "evergreen" suggests, this chromium-runtime will from this point on, be updated by the system).
As for detection, whether a given target-system already contains this runtime,
you can simply check the output of the GetMostRecentInstallPath-method:
strInstallPath = WV.GetMostRecentInstallPath
If it gives back an empty string, then you need to inform the user,
to download the little 1.7MB base-installer from the MS-webpage via this (apparently constant) Link -
(as already given in the Opener-Posting of this thread):
https://go.microsoft.com/fwlink/p/?LinkId=2124703
If you ask your user beforehand like this:
Code:
If Len(WV.GetMostRecentInstallPath) = 0 Then 'Edge-Chromium-Webview is missing on this system
If MsgBox("The needed MS-WebView2-runtime is missing," & vbLf & "Do you want to download the installer now?", vbYesNo) = vbYes Then
New_c.FSO.ShellExecute "https://go.microsoft.com/fwlink/p/?LinkId=2124703"
End If
End If
The little 1.7MB MS-Executable from that download above, will then determine which system the User actually runs (Win7, Win8, Win10) -
and then download and install the larger (about 50MB-80MB) and properly matching evergreen-runtime which will work best on the given system.
HTH
Olaf
-
Sep 11th, 2021, 12:26 PM
#34
Addicted Member
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by Schmidt
... .. .
As for detection, whether a given target-system already contains this runtime, ... .. .
... .. .
If you ask your user beforehand like this:
Code:
If Len(WV.GetMostRecentInstallPath) = 0 Then 'Edge-Chromium-Webview is missing on this system
If MsgBox("The needed MS-WebView2-runtime is missing," & vbLf & "Do you want to download the installer now?", vbYesNo) = vbYes Then
New_c.FSO.ShellExecute "https://go.microsoft.com/fwlink/p/?LinkId=2124703"
End If
End If
The little 1.7MB MS-Executable from that download above, will then determine which system the User actually runs (Win7, Win8, Win10) -
and then download and install the larger (about 50MB-80MB) and properly matching evergreen-runtime which will work best on the given system.
HTH
Olaf
Thanks a LOT, Olaf! I was thinking of doing the detection myself via a tiny function but then I also thought some function must be already existing. And, there it is! Thanks.
Kind regards.
-
Nov 28th, 2020, 09:17 AM
#35
Lively Member
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
-
Nov 28th, 2020, 09:34 AM
#36
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by saturnian
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
-
Nov 28th, 2020, 10:31 AM
#37
Lively Member
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 )
-
Nov 28th, 2020, 12:32 PM
#38
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by saturnian
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
-
Dec 6th, 2020, 10:30 AM
#39
Lively Member
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by Schmidt
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
-
Dec 9th, 2020, 02:22 PM
#40
Re: VB6 WebView2-Binding (Edge-Chromium)
 Originally Posted by saturnian
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|