Webview2 control - Chromium browser for Purebasic (Windows) [Jan 1, 2024]

Everything else that doesn't fall into one of the other PB categories.
Oliver13
User
User
Posts: 90
Joined: Thu Sep 30, 2010 6:40 am

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by Oliver13 »

The problem is ... you are to fast.
The WebView2 from MS takes a bit time to load and initialize.
Thank you for your fast response, I just assumed such a reason.

Or I secure it, but then your command is not executed and I return a #False.
Yes, I think to return #true in case of succes would be a bullet proof approach.
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by zikitrake »

Does anyone know why I keep getting the following error?
Image

I have tried to:

- Uninstall/install the webview2 library with the same result.
- Delete the entire webview2 folder and re-download the sources from github.

System info:

PB 6.00 LTS x64

Image

Thank you in advance!
PB 6.21 beta, PureVision User
vmars316
Enthusiast
Enthusiast
Posts: 474
Joined: Fri Jun 29, 2012 12:24 am
Contact:

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by vmars316 »

TIA ,
I have been away from this project (KidsafeBrowser) for a while ,
but now I am able to work on it again .
My coding works as expected EXCEPT for youtube.com .
Once on the site (at an approved link)
youtube has a way of by-passing SafeBrowser's safety-check for 'Approved Links Files .

I am doing this safety-check here "Procedure core_NavigationStaring" .

Is there a Navigation Event where I check for
1) a search
2) clicking on a youtube link to another youtube page ?
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
dartaud
New User
New User
Posts: 2
Joined: Tue Jun 20, 2023 2:22 pm

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by dartaud »

Hi,

Does anyone know how to get the URL that webview2 is currently using? LIke if user navigates to a new page? I have read forum posts here, looked at the code and tried to understand but for some reason not getting it. Thinking I am missing something, have some kind of brain block because I can't figure out how to get the URL that the webview2 control is currently using if the user clicks a link and goes to a new URL. Thanks for any help
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by Justin »

Hi, it´s been some time since i haven't looked at the code but you can use the get_Source() method of the ICoreWebView2 interface or handle the NavigationStarting event and use get_uri() on its args, and example of this is in the basic_browser_async.pb example.
dartaud
New User
New User
Posts: 2
Joined: Tue Jun 20, 2023 2:22 pm

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by dartaud »

Thanks Justin, I see now that NavigationStarting works for this.

Another question, maybe someone knows.. I noticed that the basic_browser_async.pb example supports ctrl+f in the browser window so the user can use the browser find function on the current page. I also noticed that Infratec's version of webview2 which turns it into a webgadget (which is useful) does not seem to support the ctrl+f function. Wondering if anyone knows why and how to fix this in the webgadget version of webview2 control.

again, thanks for any help
infratec
Always Here
Always Here
Posts: 7576
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by infratec »

I run into a problem with my WebView2Gadget():
In one application the content was not shown.

After digging into this problem I found a missing thing: tell the WebView2 the handle of the output 'window'.
After implemented this, it worked as it should.

I provide now a download for the complete stuff, since Justin did not implement my changes:

PBWebView2 & WebView2Gadget
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by HanPBF »

Hello,

I tried WebView2 in PureBasic and got an error in running the source with C backend compiler.

I use 6.03 beta 4 LTS (x64) on Windows 10 x64.

Compiling with both compilers work:
PureBasic 6.03 beta 4 LTS (Windows - x64)
PureBasic 6.03 beta 3 LTS - C Backend (Windows - x64)

When running the source with C backend I get the folloing error with no debugger code line:
error: expected expression before '.' token
9919 | .cSize equ 2
| ^
purebasic.c:9936:26: error: unknown type name 'get'
9936 | movzx eax, byte [r8] ; get type
|
purebasic.c:9937:1:error: expected '=', ',', ';',
beta and problem known or anything else?
source by infratec needed?

Thanks in advance, regards!
infratec
Always Here
Always Here
Posts: 7576
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by infratec »

The problem is VCall.pb

But it's not from me, it's from Wilbert.
It needs a conversion to C assembler.
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by Justin »

Hi, i updated the code to work with the c backend, it uses libffi, it's based on some code i found from Wilbert, the code is in examples\host_object.pb
So for ASM Backend uses VCall, for C Backend libffi.
The included libffi-6.dll it's needed, i could not compile it, i already had it, if someone could show how to compile from sources a dll or better a static lib would be great.
I tried this method but failed:
https://proj.goldencode.com/projects/p2 ... on_Windows
Last edited by Justin on Sun Aug 20, 2023 8:52 am, edited 1 time in total.
Boulcat
User
User
Posts: 28
Joined: Fri Feb 28, 2020 11:51 am

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by Boulcat »

Hi Justin,
Thanks for the update, I've tried the examples and everything works fine with the C backend (Windows x64)
But with the C backend (Windows x86), I get with PB 6.01 or 6.03 beta5:

Code: Select all

error: Unresolved external symbol
 '_GetAvailableCoreWebView2BrowserVersionString@8'.
POLINK: error: Unresolved external symbol 
'_CreateCoreWebView2EnvironmentWithOptions@16'.
POLINK: fatal error: 2 unresolved external(s).
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by Justin »

It seems that import does not work in x86, changed to use proptotypes.
It should work now.
The examples use by default the x64 dlls for, x86 replace them with the ones in the x86 dir

Still no luck trying to compile libffi, after running the configure script says compiler can't create executables

https://github.com/libffi/libffi
Boulcat
User
User
Posts: 28
Joined: Fri Feb 28, 2020 11:51 am

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by Boulcat »

Thanks, it now works with both x64 and x86 C Backend 8)

I tried to compile libffi by following the procedure: Building and Installing libffi on Windows
Download: https://proj.goldencode.com/downloads/m ... 140425.zip
Extract mingw64 folder to C:\mingw64
Include C:\mingw64\bin to the path: cmd as Admin > Setx /M PATH "%PATH%;C:\mingw64"

Download: https://proj.goldencode.com/downloads/m ... 111123.zip
Extract MSYS32_20111123\msys folder to C:\msys

Download: https://proj.goldencode.com/downloads/l ... ources.zip.
Extract libffi-3.2.1 folder to C:\libffi-3.2.1

Execute C:\msys\msys.bat, it opens a MINGW32:~ console
Change current directory: cd c:\libffi-3.2.1
Prepare x86 target build config: sh ./configure
Prepare x64 target build config: sh ./configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32
Build: make
But I had no success with libffi v3.4.4 releases: it lacks some files: configure, install-sh, Makefile.in,... (don't know how they are built!)

I found a complete libffi v3.4.4 source package, with the missing files included, in the powerful ImageMagick, here : https://github.com/ImageMagick/ffi
With a successful build :)
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by Justin »

Finally i could compile libffi statically for x86 and x64. For asm backend it also needs libgcc.a.
Everything is included in the last release.
It does not use VCall anymore but i have left the code and the include.

So now it should work with any system and backend without VCall.
infratec
Always Here
Always Here
Posts: 7576
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Webview2 control - Chromium browser for Purebasic (Windows)

Post by infratec »

Added the possibility to use a proxy with my WebView2Gadget()
Added an event which tells you that the Gadget is completely available (needs some time to start the whole stuff)
Added the possibility to open the development console.
Post Reply