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

Everything else that doesn't fall into one of the other PB categories.
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

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

Post by infratec »

Updated the listing above:
added a lot of new features.

But for this it was also necesarry to extend WebView2.pbi.
I addede the additional code alo in the posting above.
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

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

Post by infratec »

Updated the listing above:
added a lot of new events and procedures.

After the alert appears, open the menu and download one of the demo files.
You will see download events in the Debug window.
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 »

Thanks infratec ,
What do I need to bring KidSafafeBrowser up to date , just gdiplus ?
Thanks
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

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

Post by infratec »

vmars316 wrote: Mon Dec 12, 2022 5:23 pm What do I need to bring KidSafafeBrowser up to date , just gdiplus ?
I have no idea from what you are talking.
I created a WebView2 Gadget as a replacement for the outdated WebGadget().
Inside you can open web pages, but not browsers.
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 »

infratec wrote: Mon Dec 12, 2022 5:30 pm
vmars316 wrote: Mon Dec 12, 2022 5:23 pm What do I need to bring KidSafafeBrowser up to date , just gdiplus ?
I have no idea from what you are talking.
I created a WebView2 Gadget as a replacement for the outdated WebGadget().
Inside you can open web pages, but not browsers.
From the recent activity above
I am thinking that I may need to re-download "Webview2 control - Chromium browser for Purebasic (Windows)"
to keep up-to-date .
Thanks
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

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

Post by infratec »

To run my WebView2Gadget()

You need the original stuff from justin:
https://github.com/omegakode/PBWebview2

You need to add the extensions to webvie2.pbi
And if the original loader creates a warning about unresolved externals, you need also the version which I provided as first listing.
Then place the WebView2gadget.pbi in same folder and copy the required loader dll (x86 or x64) in the same directory.

After this the demo inside WebView2Gadget.pbi should work.

Many work, but I don't want to steal the work of justin, since my work is only an addition to his work.

If the WebView2 runtime is not installed you need also to install it from here:
https://go.microsoft.com/fwlink/p/?LinkId=2124703

But on many Win10 PCs it is already available and on Win11 it is definately installed.
Joubarbe
Enthusiast
Enthusiast
Posts: 703
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: Webview2 control - Chromium browser for Purebasic (Windo

Post by Joubarbe »

Fred wrote: Mon Sep 14, 2020 8:39 am Finally a new native solution is coming ! Thanks for the wrapper, we will look into it once it gets live.
Is there a native solution?
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Webview2 control - Chromium browser for Purebasic (Windo

Post by Kiffi »

Joubarbe wrote: Thu Dec 15, 2022 3:11 pm
Fred wrote: Mon Sep 14, 2020 8:39 amFinally a new native solution is coming ! Thanks for the wrapper, we will look into it once it gets live.
Is there a native solution?
It's about time: Internet Explorer 11 desktop app retirement FAQ :wink:
Hygge
Joubarbe
Enthusiast
Enthusiast
Posts: 703
Joined: Wed Sep 18, 2013 11:54 am
Location: France

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

Post by Joubarbe »

Hmm? Sorry I think I misunderstood the comment of Fred; thought the Web Gadget of PB was going to become a Chromium control, "natively". It's a bit cringy to still read in 2022: "The WebGadget uses the Internet Explorer 4.0+ ActiveX object on Windows. ".
plouf
Enthusiast
Enthusiast
Posts: 281
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

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

Post by plouf »

not accurate
WebGadget uses ie and can be configured up to the latest ie11 emulation (i.e full IE11) by setting properly registry

Code: Select all

Procedure SetBrowserFeatureControl(rpath.s, dwValue.i)
  dwLabel.s     = GetFilePart(ProgramFilename())   
  RegCreateKeyEx_(#HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\"+ rPath.s, 0, #Null, #REG_OPTION_VOLATILE, #KEY_ALL_ACCESS, #Null, @phkResult, @Disposition)
  RegSetValueEx_(phkResult, @dwLabel, 0, #REG_DWORD, @dwValue, SizeOf(Long))  
EndProcedure

SetBrowserFeatureControl("FEATURE_BROWSER_EMULATION", 11001)   ;; enable IE11 rendering
even when WebGadget2() becomes native using native webview2 by microsoft (chromium/edge)
WebGadget() WILL and SHOULD remain, because of very high dependency of active components in a numerous commercial products out there need this

offcourse all new design should focus in html5 but compatibility should be needed for decades...
Christos
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

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

Post by Kiffi »

For example, you could use something like this

Code: Select all

UseWebGadget([WebView2LoaderLibraryName$])
similar to UseSQLiteDatabase() or

Code: Select all

InitWebGadget([WebView2LoaderLibraryName$])
similar to InitScintilla()
Hygge
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

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

Post by Caronte3D »

plouf wrote: Thu Dec 15, 2022 6:25 pm not accurate
WebGadget uses ie and can be configured up to the latest ie11 emulation (i.e full IE11) by setting properly registry...
Wow! :shock: I don't know about it, thanks for sharing :wink:
Oliver13
User
User
Posts: 90
Joined: Thu Sep 30, 2010 6:40 am

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

Post by Oliver13 »

First I want to thank Justin and infratec for the great work !

@infratec: there seem to be a strange bug in the WebView2 gadget replacement.
Calling WebView2SetGadgetText results in an IMA

To reproduce, please modify the sample code

Code: Select all

  OpenWindow(0, 0, 0, 1230, 820, "WebView2 Gadget", #PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget)
  WebView2Gadget(1, 10, 10, 600, 800, "https://www.purebasic.fr/english")
  WebView2Gadget(2, 620, 10, 600, 800, "https://www.purebasic.fr/german")
  
  WebView2SetGadgetText(1,"https://www.purebasic.fr/english"); <--- adding this line leads to an IMA 
IMA occurs in

Code: Select all

Procedure WebView2SetgadgetText(Gadget.i, URL$)
[..]
    *Gadget\wvCore\Navigate(URL$) ; <------ here the IMA occurs
[..]
EndProcedure

Do you have any idea ? Tested with X86 code
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

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

Post by infratec »

The problem is ... you are to fast.

The WebView2 from MS takes a bit time to load and initialize.
This is done in a thread.

You can see this, because the error comes before you can see:
Debug "Webview2Controller_Created"
I can implement a flag which is set when everything is finished.
But then you still have to wait for that flag.

Or I secure it, but then your command is not executed and I return a #False.

I test now how long it blocks if I wait until the WebView2Gadget() is completely working.
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

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

Post by infratec »

I can only fix it if I add this add the end of the WebView2Gadget():

Code: Select all

Repeat
  WindowEvent()
  Delay(10)
Until WebView2GadgetMap()\InitDone
InitDone is set to #True at the end of Webview2Controller_Created()
But I don't want to do this, because I maybe loose some Events.
Post Reply