-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
Resurrected
Today, out of nowhere my program suddenly ran into "couldn't initialize Webview2 binding" on startup.
The problem remains after I tried rebooting my pc, recompliling the exe,
reinstalling webview2 runtime, running in the IDE, or reresgistering RC6 binaries.
Cannot reproduce the behaviour on my machine -
but nevertheless have uploaded a new RC6-BaseLibs-package -
which now contains the newest version of the MS 'WebView2Loader.dll' -
as well as a slightly changed BindTo-Method, which deals more thouroughly with "compatible-versions"...
Please check it out after downloading the new package (with all Dlls) -
and re-registering RC6.dll
@Bob17
This might help also in your case - though not sure (it's still a "shot into the blue" -
because - as said - cannot reproduce the behaviour).
What helped me in this regard (in the early phases of developing it) was,
to delete the "UserFolder" completely (in case you gave it a specific location) -
or to change the location to a different UserFolder-Path with "full write-rights, and nothing else in it".
HTH
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Olaf
I'm sorry to say that after registering the new DLLs, the problem remains the same: "couldn't initialize WebView-Binding".
I'm running the Webview2Demo project.
I'm starting to doubt if it's a Win7 thing. Just recently I constantly get notification from Chrome that it will not be updated in Win7 Os.
-
Re: VB6 WebView2-Binding (Edge-Chromium)
There is a fixed version Webview2 for downloading. Is it possible to test against this?
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
Resurrected
There is a fixed version Webview2 for downloading. Is it possible to test against this?
Sure, the first optional Param of the BindTo-Method allows that.
But I'd make sure, that you point it to a (lower) version of MS-Edge, which is still supported by Win7.
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Olaf
Good news.
By changing the browserInstallPath of the BindTo method, I've come to the results:
Microsoft.WebView2.FixedVersionRuntime.108.0.1462.46.x64 > couldn't initialize WebView-Binding
Microsoft.WebView2.FixedVersionRuntime.107.0.1418.62.x64 > No errors.
I'm running Win7 Os.
Regards
-
1 Attachment(s)
Re: VB6 WebView2-Binding (Edge-Chromium)
Hi Olaf,
Calling a vb6 COM dll that has RC6 WebView2 from a .NET application crashes the process (on calling BindTo method) with heap corruption error in ntdll.dll. This is reproducible, I have attached sample code with one c# forms project and one vb6 dll project. Could you please take a look and give some comments on it, maybe you can pinpoint the cause. Thanks!
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
Bob17
Hi Olaf,
Calling a vb6 COM dll that has RC6 WebView2 from a .NET application crashes the process...
I'm aware of that problem -
and .NET-compiled (32Bit-x86) Host-Processes are not the only ones who cause it...
There's also VBA (when run from within 32Bit Excel or Access.exe Processes) which has that problem.
I have currently not investigated this deeply - but my assumption is,
that a VB6-compiled 32Bit Host-Exe is initializing the vb6-runtime-dll differently on startup -
(compared to an "isolatedly loaded" VB6-COM-Dll - like the RC6 on different "Host-Exes").
In case of a VB6-compiled Host-exe the RC6-Dll "meets an already initialized vb6-runtime" (on the MainThread) -
and in case of differently compiled Host-exes, the RC6-Dll "has to initialize the vb6-runtime itself".
There is all sorts of other (threading-related things) to consider along with that -
it might be that the hosting Executables where it fails, have initialized their COM(Threads) to "MTA-mode" and not "STA-Mode".
I hesitate to invest much of my time into it - because TwinBasic offers a WebView2-Binding as well (also for VBA).
And ".NETers" have also their own "WebView2-Binding" available in a .NET-based Class-wrapper.
Is there a reason, why you want to use (32Bit only!)-VB6-compiled-COM-Dlls in a .NET-App?
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Well, I need to support such scenario where web browsing is in the COM dll and the caller is arbitrary application, possibly .NET-based. One interesting detail, if .NET app is based on Framework 3.5 or 4 then the app is not crashing!
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
Bob17
Well, I need to support such scenario where web browsing is in the COM dll and the caller is arbitrary application, possibly .NET-based. One interesting detail, if .NET app is based on Framework 3.5 or 4 then the app is not crashing!
A VB6-Host-Exe might help (which encapsulates the whole thing - including the VB6-Form you "BindTo").
You can even make this VB6-Executable an ActiveX-Exe-Project -
with your current "Dll-based Public COM-Class" exposed as a Public Class of the AciveX-Exe -
which is BTW one of the few ways, to make a VB6-Class "consumable" also by 64Bit-Host-Processes.
(remember, you cannot load a VB6-compiled 32Bit COM-Dll into a 64Bit-Process directly -
only Cross-Process-COM-calls between 64Bit-Consumer-Process and a 32Bit-ClassHost-Process allow that feat)
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
Schmidt
I'm aware of that problem -
and .NET-compiled (32Bit-x86) Host-Processes are not the only ones who cause it...
There's also VBA (when run from within 32Bit Excel or Access.exe Processes) which has that problem.
I have currently not investigated this deeply - but my assumption is,
that a VB6-compiled 32Bit Host-Exe is initializing the vb6-runtime-dll differently on startup -
(compared to an "isolatedly loaded" VB6-COM-Dll - like the RC6 on different "Host-Exes").
In case of a VB6-compiled Host-exe the RC6-Dll "meets an already initialized vb6-runtime" (on the MainThread) -
and in case of differently compiled Host-exes, the RC6-Dll "has to initialize the vb6-runtime itself".
There is all sorts of other (threading-related things) to consider along with that -
it might be that the hosting Executables where it fails, have initialized their COM(Threads) to "MTA-mode" and not "STA-Mode".
I hesitate to invest much of my time into it - because TwinBasic offers a WebView2-Binding as well (also for VBA).
And ".NETers" have also their own "WebView2-Binding" available in a .NET-based Class-wrapper.
Is there a reason, why you want to use (32Bit only!)-VB6-compiled-COM-Dlls in a .NET-App?
Olaf
Hello Olaf. You are right. By creating an ActiveX-Exe and exposing a cWebView2 wrapper as a public class of the ActiveX-exe I can use WebView2 in my PowerBuilder application without problems (something that directly using RC6 I have not achieved). Not ideal, but at least I have a choice.
Thank you very much!
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Hi,
I have the same problem as Resurrected.
So Resurrected seems to solve with 'Microsoft.WebView2.FixedVersionRuntime.107.0.1418.62.x64' but i have not found the installer of this version.
Microsoft publish the latest version only.
Anybody can help me ?
-
Re: VB6 WebView2-Binding (Edge-Chromium)
The download for fixed versions is at the bottom-right-corner of this page:
https://developer.microsoft.com/en-u...edge/webview2/
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Hi Olaf,
Yes i see but it is a CAB.
How to install or use this one ? I'm lost.
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
darjeeling
...but it is a CAB.
Win10 has direct support for unpacking of *.cab-Archives -
otherwise use 7zip?
In any case, you should end up with an unpacked Folder, named:
..\Microsoft.WebView2.FixedVersionRuntime.107.0.1418.62.x86
somewhere on your local harddisk.
Now move that whole Folder to a place you prefer in your filesystem -
and then point the 3rd Param of the BindTo-method to that Directory-Path-(String).
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Ok Olaf,
Thank you very much and Merry Christmas !
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Hello.
Is there a project / template for this so that the WebView2 can also be used as an HTML editor?
Thank you very much and Merry Christmas!
Andreas
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
EasyOneX
Is there a project / template for this so that the WebView2 can also be used as an HTML editor?
Sure ... did you ever try-out:
WV.OpenDevToolsWindow
... after a successful WV.BindTo(...) call?
It's (in the meantime) a full-blown IDE-environment with live-changes in the "View",
as soon as you edit and save *.html and *.css files
(also including support for *.js-Debugging of course).
The DevTools-Window is highly configurable (just play around with it for a day or two) -
and it allows write-interaction with the local FileSystem, once you specify a "trusted root-folder"
(which is usually the root-folder of your "localhost" Webserver-instance - be that NodeJs or IIS or Nginx).
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Hi Olaf,
My tests:
1 - Windows 7
MicrosoftEdgeWebView2RuntimeInstallerX86 installed on Windows 7.
First try:
WV.BindTo(picWV.hWnd) => "couldn't initialize WebView-Binding"
Second try:
...
P = WV.GetMostRecentInstallPath
(WV.GetMostRecentInstallPath seems to be the right path)
WV.BindTo(picWV.hWnd), , P) => Crash of VB6
and again...
WV.BindTo(picWV.hWnd) => OK it works
2 - Windows 10
No problem it works at anytime !
A solution for Windows 7 ?
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
darjeeling
P = WV.GetMostRecentInstallPath
GetMostRecentInstallPath gives the path to the "Evergreen-Version" (which the "normal" MS-installer is for).
If you want to work against an older "Fixed-Version" (like the one in your *.cab-download),
you have to set:
P = "C:\some\path\to\my\unpacked\Microsoft.WebView2.FixedVersionRuntime.107.0.1418.62.x86"
and pass that P-StringVariable into the Bind-call.
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Hi Olaf,
Thank you i'll try.
Regards
-
1 Attachment(s)
Re: VB6 WebView2-Binding (Edge-Chromium)
Hello
I tested the demo under w7 but I'm getting this error
Attachment 186547
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
Adebiyi24
The reason for this was mentioned a few times already in this Codebank-Thread.
(the Event-interface was changed slightly in newer RC6-versions).
Just comment out the Event-Handler you're having problems with completely -
and then "re-select" the EventHandler from the DropDown-ComboBox at the TopRight of the IDEs CodeEditor
(in case you need this specific Event at all)...
I've not yet uploaded a new Demo-Zip, because the cWebView2.cls is still getting enhancements -
and is not yet "entirely finalized" (COM-interface-wise)...
I'll always try my best though, to not break the stuff which is currently "in use and established"...
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
@paliadoyo, Bob17, Resurrected
...or anybody else who previously had problems with loading WebView2 in "other Host-Processes" like:
Excel(32Bit), .NET(32Bit), Powerbuilder(32Bit)
I think I've found (and fixed) something over the Holidays regarding "more robust BindTo/Loading" ...
Please download RC6 version 6.0.12 from the usual place and check with that (after re-registering).
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Hi Olaf,
RC6 version 6.0.12:
RC6BaseDlls.zip -> HTTP Error 404.0 - Not Found
Regards
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
darjeeling
Hi Olaf,
RC6 version 6.0.12:
RC6BaseDlls.zip -> HTTP Error 404.0 - Not Found
Oops, messed up my FTP-Upload - please try again...
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Hi again,
If WV.BindTo(picWV.hWnd) = 0 Then MsgBox "couldn't initialize WebView-Binding": Exit Sub
Sorry but the same problem remain: "couldn't initialize WebView-Binding"
Regards
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Hi again,
I tested several solutions under Windows 7 but without success.
I confirm that I have no problem under Windows 10.
On the other hand, the source code of Wolf (http://www.ww-a.de/download/WebView2-Demo.zip) works perfectly on Windows 7. However, I could not reproduce the 'BinTo' method of Wolf.
I am disappointed.
Regards
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
darjeeling
If Wolfgangs code is working (in your VB6-IDE on Win7) -
then you're doing something wrong in your "init-sequence"...
Here's a minimal Demo-Code for an empty Project with a Form1 (and a reference to RC6)
Code:
Option Explicit
Private WithEvents WV As cWebView2
Private Sub Form_Load()
Me.Caption = New_c.Version 'just to check, which RC6-Version is in use...
Me.Visible = True 'the FormOrPicBox.hWnd needs to be Visible, before the BindTo-call
Set WV = New_c.WebView2
If WV.BindTo(Me.hWnd) Then
WV.Navigate "https://google.com"
Else
MsgBox "Couldn't bind the WebView to the Form.hWnd"
End If
End Sub
Private Sub Form_Resize() 'ensure full coverage of the Containers ClientArea with the WebView
If Not WV Is Nothing Then WV.SyncSizeToHostWindow
End Sub
HTH
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Olaf thank you very much for trying to help me but it still doesn't work.
I have checked the registry keys (HKLM and HKCU) concerning the runtime and tried different versions of this runtime but nothing changes.
I will resolve to use it under Windows 10 even if I hate Windows 10....
-
Re: VB6 WebView2-Binding (Edge-Chromium)
It works like a charm!
As always, thank you very much for your interest and effort in solving our problems.
Regards
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Hi Olaf,
Good news !
Now it works fine on Windows 7.
Code:
Option Explicit
Private Cairo As cCairo
Private WithEvents WV As cWebView2
Private Sub Form_Load()
Me.Visible = True
Set Cairo = New_c.Cairo
Set WV = New_c.WebView2
Cairo.SetDPIAwareness
If WV.BindTo(Me.hWnd) = 1 Then
Me.Caption = "INIT OK"
WV.Navigate "https://google.com"
Else
MsgBox "Couldn't bind the WebView to the Form.hWnd"
End If
End Sub
Private Sub Form_Resize() 'ensure full coverage of the Containers ClientArea with the WebView
If Not WV Is Nothing Then WV.SyncSizeToHostWindow
End Sub
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Hi Olaf,
I wanted to test your BindTo improvements but the vbrichclient.com is having some error 500 problems.
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
Bob17
Hi Olaf,
I wanted to test your BindTo improvements but the vbrichclient.com is having some error 500 problems.
Microsoft seems to be forcing everything related to IE to be removed from the browser, and I don't know if the recent frequent failures (inability to download files) of vbrichclient.com are related to Olaf's use of IIS.
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
SearchingDataOnly
Microsoft seems to be forcing everything related to IE to be removed from the browser, and I don't know if the recent frequent failures (inability to download files) of vbrichclient.com are related to Olaf's use of IIS.
Site was just down due to mystery server reasons....it looks like it's back up now. Maybe Olaf should have used Nginx :P
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
jpbro
Maybe Olaf should have used Nginx :P
Yes, Nginx + VbFcgi is much better than IIS.
-
Re: VB6 WebView2-Binding (Edge-Chromium)
hello Olaf
with currently available versions 108... and 109... of Microsoft.WebView2.FixedVersionRuntime, I have a crash that takes me out of the IDE when calling the BindTo function (WV.BindTo(picWV.hWnd, 8, EdgePath, DataEdgePath, TmpLang) ). I have the same problem when compiling the project
I have no problem with version 103 and I have no problem with the Evergreen version either.
Have you experienced this?
Thank you in advance for your answer
François
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
saturnian
WV.BindTo(picWV.hWnd, 8, EdgePath, DataEdgePath, TmpLang)
On what OS do you encounter this?
Where does EdgePath point to? (a "fixed version")?
Where does DataEdgePath point to? (a truly writable location for this User)?
What happens on this machine, when you call it without any "Extra-Params":
WV.BindTo(picWV.hWnd)
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
=Schmidt;5592174]On what OS do you encounter this?
OS is Windows 10 an Windows 11 (tested on 4 computers and on several VMs)
Quote:
Where does EdgePath point to? (a "fixed version")?
C:\ProgramData\OrdoWebView2\Microsoft.WebView2.FixedVersionRuntime
If i use C:\Microsoft.WebView2.FixedVersionRuntime that doesn't work either
If in these directories I put version 103.x.x.x of the Webview 2 component, it works perfectly. Newer versions 108.x.x.x and 109.x.x.x do not work
Quote:
Where does DataEdgePath point to? (a truly writable location for this User)?
C:\ProgramData\OrdoWebView2\Microsoft.WebView2.FixedVersionRuntime\Data
or
C:\Microsoft.WebView2.FixedVersionRuntime\Data
Quote:
What happens on this machine, when you call it without any "Extra-Params":
WV.BindTo(picWV.hWnd)
it works perfectly because it uses the Evergreen version which works perfectly (and it's a 109.x.x.x version !!!)
Does the latest fixed version 109.x.x.x available from MS work on your computers?
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
saturnian
...the Evergreen version which works perfectly (and it's a 109.x.x.x version !!!)
At least that's then something to "automatically fall back to" (when a fixed-version-folder-param doesn't work).
Quote:
Originally Posted by
saturnian
Does the latest fixed version 109.x.x.x available from MS work on your computers?
Will check it out (probably this weekend) - and report back, when an easy fix was possible...
Olaf
-
Re: VB6 WebView2-Binding (Edge-Chromium)
Quote:
Originally Posted by
Schmidt
At least that's then something to "automatically fall back to" (when a fixed-version-folder-param doesn't work).
Olaf
the issue is that there is no trappable error.
The BindTo function exits violently without an error message whether interpreted or compiled
In interpreted the IDE crashes