Chromium WebGadget v4

Developed or developing a new product in PureBasic? Tell the world about it.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

The routine to check browser version is a simple PowerShell command.

Code: Select all

(Get-AppxPackage -Name "Microsoft.MicrosoftEdge.Stable").Version
Instead of removing the Procedure or trying to figure out the issue, I've added a command-line parameter to ignore the version check...

Please download the latest free package with the most recent updates (includes numerous improvements).
- since moving to SSE, my Cloudflare Workers script was no longer required to bypass CORS

Instead of double-clicking the executables, use one of the following options with the IgnoreVersion parameter (case insensitive).
- execute the file from the Windows Run dialog
- execute the file from a Command Prompt
- execute the file from a Shortcut

NB*: Free executables (x86/x64) can be downloaded from My PureBasic Stuff; see FREE STUFF.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

Hi,

I updated Edge.
Versión 100.0.1185.50

and get the prompt telling me that it can't be found.

My W10 is in spanish.

Running the IgnoreVersion it works!!

I will test it in https://youtube.com and it worked just fine!!

Also i found that in the registry, in HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062} in key pv you find the version
ARGENTINA WORLD CHAMPION
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

Thank you for downloading and testing the Chromium Edge WebGadget. After reading your comment about YouTube, I did some additional testing and found a few things I wanted to change and a few things I wanted to add.

-----------------------------

Updated:
- added Procedure CE_WebGadget_Callback
- updated example CE_WebGadget_URL.pb
- numerous improvements

CE_WebGadget_Callback
This is a backend Procedure that is never initiated by the user. It provides full screen functionality to video players (YouTube, Vimeo, etc.) that have the full screen option, as well as improving keyboard and mouse focus.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Updated:
- improved CE_WebGadget_Callback Procedure
- improved CE_WebGadget_Update Procedure
- improved CE_WebGadget_Open Procedure
- improved CE_WebGadget_URL.pb example
- improved Command Line Switches

CE_WebGadget_Update
In addition to modifying the URL, this Procedure now supports Back, Forward, Home and Refresh.
- the default Home page URL can now be modified from the CLS file

Command Line Switches
CLS files can now be assigned individually. In addition, the location has changed from the root folder to \sources\cls.

The example CE_WebGadget_URL.pb has been updated to better demonstrate the new features.
- with the modified CLS file, changes to a webpage will be saved into the CE WebGadget profile directory (does not effect the default browser)
Last edited by JHPJHP on Tue May 03, 2022 8:54 pm, edited 1 time in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Updated:
- renamed CE_WebGadget_URL.pb to CE_WebGadget_Browser.pb
- to many changes and improvements to be listed
- various bug fixes

CE_WebGadget_Browser.pb
Working on this example has helped with improvements and tracking down the various bugs.
Last edited by JHPJHP on Sun May 01, 2022 6:07 pm, edited 2 times in total.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

Hio,

Here it crashed and it only remains some egde opened. No matter what example i tried to run.

Even:

Code: Select all

Enumeration
  #MainWindow
  #CE_WebGadget
EndEnumeration

IncludeFile "sources\cewg_sources.pbi"

If OpenWindow(#MainWindow, 0, 0, 800, 600, "Chromium Edge WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CE_WebGadget(#CE_WebGadget, 10, 10, 400, 300, #CE_WebGadget_Flat)
  cewg.CEWG_DATA
  cewg\GadgetNumber = #CE_WebGadget
  cewg\SourceURL = "http://purebasic.com" 
  CE_WebGadget_Init(cewg)
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

I used the ignoreversion because for some reason it does not detect my edge.
ARGENTINA WORLD CHAMPION
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,
ricardo wrote:Here it crashed and it only remains some egde opened. No matter what example i tried to run.
Sorry, should have posted that the following Compiler Option must be enabled: Enable DPI aware executable (Windows).

Chromium Edge WebGadget has been updated, warning when the DPI compiler option is not enabled; code snippet from here.

Please download the latest package; includes various updates and improvements since my last post.
Last edited by JHPJHP on Sun May 01, 2022 9:38 pm, edited 2 times in total.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

Image


I think, i may be wrong, that the part of detecting the Edge and using the IgnoreVersion is the problem. Or mat least is one problem that never let this run fine here.
ARGENTINA WORLD CHAMPION
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

Thank you for testing and reporting your findings.

Not knowing more about the problem, numerous changes were made to various parts of the code.

Please download the latest version and let me know if the changes resolved the problem.

NB*: The Procedure to test browser version was not changed, so you will probably still need the IgnoreVersion switch.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

Great, its working.


Now i ask you a very simple code showing how to obtain the url of the webgadget, if the user navigates by himself and how to use javascript from and to the browser. But a very simple code, straight, no fancy stuff that complicates to undertsnad/learn. Thanks an congratullation for you hard work.

Code: Select all

Enumeration
  #MainWindow
  #CE_WebGadget
EndEnumeration

IncludeFile "sources\cewg_sources.pbi"

If OpenWindow(#MainWindow, 0, 0, 800, 600, "Chromium Edge WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CE_WebGadget(#CE_WebGadget, 10, 10, 750, 550, #CE_WebGadget_Flat)
  cewg.CEWG_DATA
  cewg\GadgetNumber = #CE_WebGadget
  cewg\SourceURL = "http://youtube.com" 
  CE_WebGadget_Init(cewg)
  Repeat : 
    
    ;hOW TO FIND THE URL OF THWEBGADGET AND HOW TO SEND AND RECEIVE JS
    
    
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
ARGENTINA WORLD CHAMPION
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

Sorry if you've wasted your time, but what you're asking for is mostly not available.

This framework was never intended to pass JavaScript to and from a public webpage; you may want to try one of the following.
- Webview2 control - Chromium browser for Purebasic (Windows) ~Justin
- PB.Ex WebGadget (Windows) (WebKit) ~RSBasic

--------------------------------

Updated:
- various small improvements

NB*: Chromium Edge WebGadget free executables were also updated.
Last edited by JHPJHP on Tue May 03, 2022 2:11 pm, edited 2 times in total.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

JHPJHP,

And its possible to find the url, if the user navigate using this webgadget?

Thanks
ARGENTINA WORLD CHAMPION
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Hi ricardo,

Code: Select all

And its possible to find the url, if the user navigate using this webgadget?
Please download the latest update; includes name changes listed below.

Get Address
Address$ = CE_WebGadget_Update(cewg_data, "GetAddress")

Get Description
Description$ = CE_WebGadget_Update(cewg_data, "GetDescription")

Set Address (must include :// to identify it as a URL)
cewg_data\SourceURL = "https://www.purebasic.com"
CE_WebGadget_Update(cewg_data, "SetAddress")

If SourceURL has not changed it will reload the current page, not the same as Refresh.

Back : CE_WebGadget_Update(cewg_data, "Back") : Return "ActionCompleted" if available.
Forward : CE_WebGadget_Update(cewg_data, "Forward") : Return "ActionCompleted" if available.
Refresh : CE_WebGadget_Update(cewg_data, "Refresh") : Return "ActionCompleted" if available.
Home : CE_WebGadget_Update(cewg_data, "Home") : Return "ActionCompleted" if available.

Calling Refresh with a modified SourceURL is the same as SetAddress.

User defined Home page can be set from a Command Line Switch (CLS) file.
Internal switches match the default CLS file: \sources\cls\_CE_WebGadget.cls.
Remove the leading underscore from the default CLS file to overriding internal settings.
Individual CLS files can be set with the Constant #CE_WebGadget_CLS_Filename.
- must be located above the IncludeFile command; see CE_WebGadget_Browser.pb

Additional Notes
The PowerShell script checking for the Microsoft Edge version has been updated.

Previously, for testing purposes the CEWG Users Profile Directory was saved to the temporary folder.
Now, the CEWG Users Profile Directory is saved to the logged on users Program Data folder (\Users\[user name]\Appdata\Roaming.

Added the following Constant: #CE_WebGadget_Override_User_Directory; must be located above the IncludeFile command.
The CEWG Users Profile Directory is saved to the current folder \sources\profiles.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Chromium Edge WebGadget

Post by JHPJHP »

Updated:
- numerous improvements

Numerous Improvements
I wrote enough in my previous post, suffice to say this version is better.
Last edited by JHPJHP on Wed May 04, 2022 6:52 pm, edited 1 time in total.
ricardo
Addict
Addict
Posts: 2402
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Chromium Edge WebGadget

Post by ricardo »

Hi,

Great!!

---------------------------------------------------------------------------
The PowerShell script checking for the Microsoft Edge version has been updated.
Still does not find my Edge.

--------------------------------------------------------------------------
Its me or its taking some time to show url and description. (Its okay for me, just want to know if this the way it works or its me)

Run it with debugger and browse to any video and click the button.

Code: Select all

Enumeration
  #MainWindow
  #CE_WebGadget
  #Button
EndEnumeration

IncludeFile "sources\cewg_sources.pbi"

If OpenWindow(#MainWindow, 0, 0, 800, 600, "Chromium Edge WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ButtonGadget(#Button,10,520,100,25,"Get URL")
  CE_WebGadget(#CE_WebGadget, 10, 10, 700, 450, #CE_WebGadget_Flat)
  cewg.CEWG_DATA
  cewg\GadgetNumber = #CE_WebGadget
  cewg\SourceURL = "http://youtube.com" 
  CE_WebGadget_Init(cewg)
  
  
  Repeat : 
    Event = WaitWindowEvent()
    Select Event
      Case #PB_Event_Gadget
        Select EventGadget()
          Case #Button
            Debug "click"
            Address$ = CE_WebGadget_Update(cewg, "GetAddress")
            Debug Address$
            Description$ = CE_WebGadget_Update(cewg, "GetDescription")
            Debug Description$
         EndSelect
        
     EndSelect
    
  Until Event = #PB_Event_CloseWindow
EndIf

ARGENTINA WORLD CHAMPION
Locked