News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

WebView2 test

Started by TimoVJL, November 26, 2023, 09:51:24 PM

Previous topic - Next topic

TimoVJL

May the source be with you

jj2007

Windows 10, with Ms Edge as default browser:
I tried the exe, but it says it needs the runtime.
Then I tried installing the runtime, but it says won't work as it is already installed.
 :rolleyes:

TimoVJL

Quote from: jj2007 on November 26, 2023, 11:58:09 PMWindows 10, with Ms Edge as default browser:
I tried the exe, but it says it needs the runtime.
Then I tried installing the runtime, but it says won't work as it is already installed.
 :rolleyes:
Do you have WebView2Loader.dll already in a your system ?
May the source be with you

Biterider

Hi Timo
Thank you for your sample application.  :thumbsup:

The installation of the RT also fails, similar to JJ's attempt, but I discovered that the WebView2Loader.dll file exists several times on my system. I took the latest version and copied it to your files and presto, it displays our forum WebSite... cool  :cool:


Biterider

TimoVJL

Thanks Bitrider,
An example was based from sourcecode, that can been seen from links, so my part was quite small.
May the source be with you

Biterider

Hi Timo
I have looked around in the source code and the most difficult part is the COM interfaces, but everything can be done in assembler too.
If I find some time, I will do it.

Biterider

jj2007

Quote from: Biterider on November 27, 2023, 02:03:09 AMI discovered that the WebView2Loader.dll file exists several times on my system

Where did you find these files? I can't find any on my Win10 machine :sad:

TimoVJL

#7
One link for WebView2Loader.dll and header and libs ...

Microsoft.Web.WebView2

7-zip can open it.

WebView2Test1 open DeepL translator page

In WebView2h_min.zip is reduced WebView2.h for faster compiling
May the source be with you

jj2007

#8
Quote from: TimoVJL on November 27, 2023, 11:59:50 AMOne link for WebView2Loader.dll and header and libs ...

Microsoft.Web.WebView2

dotnet add package Microsoft.Web.WebView2 --version 1.0.2151.40
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from: https://aka.ms/dotnet-download

TimoVJL

Just download that microsoft.web.webview2.1.0.2151.40.nupkg from Download package  (7.57 MB)
and use 7-Zip

Direct link:
https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/1.0.2151.40

WebView2Loader.dlls are in
\runtimes\win-x86\native\
\runtimes\win-x64\native\
folders

It is a WebView SDK
May the source be with you

jj2007

Yep, that worked :thumbsup:

Your exe loads the Masm forum, great.

To build it, I tried (successfully) \masm32\bin\polib.exe /OUT:WebView2Loader.lib /MACHINE:x86 WebView2Loader.dll

However, polink complains:
POLINK: error: Unresolved external symbol '_CreateCoreWebView2EnvironmentWithOptions@16' - referenced from '\Masm32\Members\Timo\Webview2\WebView2Test.obj'.

If I comment out that call in line 13, it builds and runs :thumbsup:

TimoVJL

#11
POLIB /DEF:WebView2Loader.def /OUT:WebView2Loader.lib /MACHINE:x86

LIBRARY WebView2Loader.dll
EXPORTS
_CompareBrowserVersions@12 = CompareBrowserVersions
_CreateCoreWebView2Environment@4 = CreateCoreWebView2Environment
_CreateCoreWebView2EnvironmentWithOptions@16 = CreateCoreWebView2EnvironmentWithOptions
_GetAvailableCoreWebView2BrowserVersionString@8 = GetAvailableCoreWebView2BrowserVersionString
x64
POLIB /DEF:WebView2Loader.def /OUT:WebView2Loader.lib /MACHINE:x64
LIBRARY WebView2Loader.dll
EXPORTS
CompareBrowserVersions
CreateCoreWebView2Environment
CreateCoreWebView2EnvironmentWithOptions
GetAvailableCoreWebView2BrowserVersionString
EDIT: example with cl -Fa assembler output
May the source be with you

TimoVJL

#12
Have anyone tried several times app running in same time with same site like DeepL ?
Sometimes DeepL warns about too many sessions ?

DeepL test

EDIT:
Perhaps it happens after over ten sessions in same time.
A red red alert says, that 'Something went wrong, try to reload page (S-1)' or something like that.
May the source be with you

Vortex

Quote from: TimoVJL on November 30, 2023, 01:35:26 AMHave anyone tried several times app running in same time with same site like DeepL ?
Sometimes DeepL warns about too many sessions ?

Hi Timo,

Your Pelles C example didn't report any warning while visiting DeepL :thumbsup:

jorgon

Hi All

Many thanks TimoVJL for the files showing how you implemented WebView2 in C, and in particular the header files and the exe.  Prior to seeing these files, I had got very bogged down trying to decipher the .net stuff.  I was getting quite frustrated because I like to know how things work which is why I like assembler, but I find that stuff quite incomprehensible.  The code is further obscured by the multitude of header files, includes and static libs with no way of knowing which are being used by the code in question.

The exe that you posted allowed me to see how the implementation looks in assembler, and so I was able to create the attached sample, which I note is actually a lot simpler than the old WebBrowser2 implementation.

The attached files create an ordinary window and displays the MASM forum inside.  It relies on one Windows redistributable DLL - WebView2Loader.dll (in this case the 32 bit version).  The call to that DLL kicks everything off as can be seen from the code.

All the code is all in one file (no includes) which makes it easier to follow.

Sorry, it's in GoAsm but obviously could be converted to your favourite assembler.

Cheers

Jeremy