html5 IE gadget project

Windows specific forum
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

html5 IE gadget project

Post by idle »

Webview is a small cross platform c lib of embedding a browser supporting JS and CSS injection with two way coms.
It's not a gadget yet but just a test before I turn it into a gadget for a larger embedded web server project.
I'd like to get some feedback, does it work as expected.
It should launch a webview to an animated html5 page @ https://html5up.net/hyperspace
Once closed it should then show a webview with two clickable buttons that will pop up alerts of the button you clicked.

note don't set the compiler to compile in the current directory as it will quirk back to IE4 :?
though you can create the executable there and run it.

Does it work on win7 or Win8 with it's default browser?

Files are here, save and open webview.pbi compile with x86

https://www.dropbox.com/sh/ali08ef86qa2 ... 61Zra?dl=0

Webview also supports linux and osx and the two way coms feature opens up the possibility to create workable html guis
if your not adverse to javascript, could also use spiderbasic

c source files here
https://github.com/zserge/webview
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: html5 IE gadget project

Post by Kwai chang caine »

Hello IDLE :D
I run your code and it search "Ressource.rc"
I remove the "Ressource.rc" in the compiler panel and apparently that works 8)

Image

I'm on W7 x86 / v5.61 x86 :wink:
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: html5 IE gadget project

Post by idle »

What no Gif ! :mrgreen:

Thanks for testing, what version of windows did you try it on kcc?

I updated the file and remoed the rc manifest reference.
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: html5 IE gadget project

Post by chi »

Finally :P
Image

Works on Win7 x64 (SP1) with PB 5.70b1 x86! Keep up the good work ^^
Et cetera is my worst enemy
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: html5 IE gadget project

Post by idle »

chi wrote:Finally :P
Image

Works on Win7 x64 (SP1) with PB 5.70b1 x86! Keep up the good work ^^
Finally indeed. and that beats a gif! :lol:
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
Kiffi
Addict
Addict
Posts: 1353
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: html5 IE gadget project

Post by Kiffi »

Hello idle,

well done! Kudos! Image

Works on Windows 7 (64bit) like a charm. :D

(i will test it later in the evening with Linux Mint)

Greetings ... Peter
Hygge
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: html5 IE gadget project

Post by idle »

Kiffi wrote:Hello idle,

well done! Kudos! Image

Works on Windows 7 (64bit) like a charm. :D

(i will test it later in the evening with Linux Mint)

Greetings ... Peter
Hi Kiffi, you might need to change the def of webview_api to
#define WEBVIEW_API __declspec(dllexport)
and add
#include <stdio.h>
#include <tchar.h>
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: html5 IE gadget project

Post by Kwai chang caine »

MASTER Idle wrote:What no Gif ! :mrgreen:
:lol: :lol:
MASTER Idle wrote:Thanks for testing
Always a pleasure to read you, and test your jewels codes, my friend of the other side of the world, 8) where there is no kangarou :oops: :lol:
MASTER Idle wrote:what version of windows did you try it on kcc?
You are so surprising to not see GIF, that apparently you not see too, my config writing above :lol:
Your fan above wrote:I'm on W7 x86 / v5.61 x86 :wink:
ImageThe happiness is a road...
Not a destination
juror
Enthusiast
Enthusiast
Posts: 228
Joined: Mon Jul 09, 2007 4:47 pm
Location: Courthouse

Re: html5 IE gadget project

Post by juror »

A series of 5 or 6 JScript errors on my system as it loads. Occasional errors on other functions. Blank HTML window with "Can't reach this page upon closing. Very encouraging so far.

cheers

W10 x64
PB 32 5.6
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: html5 IE gadget project

Post by idle »

juror wrote:A series of 5 or 6 JScript errors on my system as it loads. Occasional errors on other functions. Blank HTML window with "Can't reach this page upon closing. Very encouraging so far.

cheers

W10 x64
PB 32 5.6
Did you build it as an exe and run it?
Compiling with F5 will result in it quirking back to IE4, I suspect it's an inherited manifest issue.
I'm on w10 x64 compiled with PB 5.62 x86
Windows 11, Manjaro, Raspberry Pi OS
Image
juror
Enthusiast
Enthusiast
Posts: 228
Joined: Mon Jul 09, 2007 4:47 pm
Location: Courthouse

Re: html5 IE gadget project

Post by juror »

"Create executable" - in it's own folder with the dll and lib files

line 2
char 6997
Unable to get property 'create element' of undefined or null reference
code 0
URL htps://html5up.net/uploads/demos/hyperspace/assets/js/jquery.min.js
do you want to continue running scripts

get it 5 or 6 times - each with a slightly different line/char

when the page does open
script error https//platform.twitter.com/widgets.js?1529011964999

I do run an ad blocker in chrome, which is my main browser.

cheers
(hope there are no typos above)
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: html5 IE gadget project

Post by idle »

Thanks for testing it Juror, odd that it's still quirking on your system.
I found that by setting the Feature_Browser_Emulation in the host application directly worked with F5 compile
It's being set in the dll but maybe it's not working as expected when it's hosted.

Can you try this, It will set the compatibility to IE 9 which should be OK for html5

plus if you have no script set in IE that could possibly be another explanation?

Code: Select all

PrototypeC webview_external_invoke_cb_t(*webview,arg.s)
PrototypeC webview_dispatch_fn(*webview,arg.s) ;


Structure webview_priv 
	hwnd.i;
	*browser 
	is_fullscreen.i;
	saved_style.l;
	saved_ex_style.l;
	saved_rect.RECT ;
EndStructure 

Structure webview 
	url.s
	title.s;
	width.l;
	height.l;
	resizable.l;
	nDebug.l;
	*external_invoke_cb.webview_external_invoke_cb_t ;
	priv.webview_priv;
	*userdata;
EndStructure ;

Structure webview_dispatch_arg
	*fn.webview_dispatch_fn;
	*webview.webview;
	*arg;
EndStructure ;

#WEBVIEW_DIALOG_TYPE_OPEN = 0
#WEBVIEW_DIALOG_TYPE_SAVE = 1
#WEBVIEW_DIALOG_TYPE_ALERT = 2

ImportC "webview.lib" 
  webview.l(title.s,url.s,width.l,height.l,resizable.l);
  webview_init.l(*webview.webview)
  webview_loop.l(*webview.webview,blocking.l);
  webview_eval.l(*webview.webview,*js.p-utf8);
  webview_inject_css.l(*webview.webview,css.s);
  webview_set_title.l(*webview.webview,title.s);
  webview_set_fullscreen(*webview.webview,fullscreen.l);
  webview_set_color(*webview.webview,r.a,g.a,b.a,a.a);
  webview_dialog(*webview.webview,webview_dialog_type,flags.l,title.s,arg.s,*result.string,resultsz.i);
  webview_dispatch(*webview.webview,*fn.webview_dispatch_fn,*arg);
  webview_terminate(*webview.webview);
  webview_exit(*webview.webview);
  webview_debug(format.s,*args,*args1=0,*args2=0,*args3=0,*args4=0,*args5=0,*args6=0,*args7=0,*args8=0);
  webview_print_log(*s.string); 
EndImport   

Procedure SetFeature_Browser_Emulation() 
  Protected lpValueName.s,lpData.l,phkResult
  lpValueName.s = GetFilePart(ProgramFilename()) 
  lpData = $9000;11001 ;9000 
  If RegCreateKeyEx_(#HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", 0, #Null, #REG_OPTION_VOLATILE, #KEY_ALL_ACCESS, #Null, @phkResult, @lpdwDisposition) = #ERROR_SUCCESS
    RegSetValueEx_(phkResult, lpValueName, 0, #REG_DWORD, @lpData, SizeOf(LONG))
    RegCloseKey_(phkResult)
  EndIf 
EndProcedure 

Procedure DelFeature_Browser_Emulation() 
  Protected phkResult,lpValueName.s  
  lpValueName.s = GetFilePart(ProgramFilename()) 
  If RegOpenKeyEx_(#HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", 0, #KEY_SET_VALUE, @phkResult) = #ERROR_SUCCESS
      RegDeleteValue_(phkResult, lpValueName)
      RegCloseKey_(phkResult)
  EndIf
EndProcedure   


ProcedureC WebviewEval(*wv,*arg)
  Protected *msg,input.s 
  input = PeekS(*arg,-1,#PB_UTF8)
  *msg = UTF8("alert('You clicked " + input + "');")
  ;it's safe to call webview_eval now 
  webview_eval(*wv,*msg);
  
EndProcedure   

ProcedureC CBExternInvoke(*wv,*arg) 
  ;webview called this function  
  Debug PeekS(*arg,-1,#PB_UTF8) 
  ;passes the function pointer to the browser which then calls the function when its ready
  webview_dispatch(*wv,@webvieweval(),*arg)  
EndProcedure   

Global wv.webview 

SetFeature_Browser_Emulation()

;if you just want to display a page, blocks until window is closed no interaction 
webview("PB_WebView: Supports HTML5","https://html5up.net/hyperspace",800,600,1) 
;webview("PB_WebView: Supports HTML5","http://localhost:8080",800,600,1) 

dir.s = GetCurrentDirectory() ; open webview.pbi from explorer should set it 

;if you want a bit more control 
wv\title = "PB_WebView Demo 2 way comms" 
wv\width = 800 
wv\height = 600 
wv\resizable = 1 
wv\url = "file://" + dir + "index.html" 
wv\resizable =1 
wv\external_invoke_cb = @CBExternInvoke()
  
webview_init(@wv)

While webview_loop(@wv,1) = 0  
Wend 
webview_exit(@wv)

DelFeature_Browser_Emulation()

Windows 11, Manjaro, Raspberry Pi OS
Image
juror
Enthusiast
Enthusiast
Posts: 228
Joined: Mon Jul 09, 2007 4:47 pm
Location: Courthouse

Re: html5 IE gadget project

Post by juror »

Seems to work fine now except when you end the program you receive a window

Title: PB WebView Demo 2 way coms

Can't reach this page
Make sure the web address is correct
search on Bing
Refresh the page (doesn't refresh)

cheers
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: html5 IE gadget project

Post by idle »

Hi Juror, thanks for your patience.

It didn't find the index.html, it was looking for it from the currentdirectory
Anyway thanks for testing it and confirming it works
I will get around to making it into a gadget soon.
Windows 11, Manjaro, Raspberry Pi OS
Image
juror
Enthusiast
Enthusiast
Posts: 228
Joined: Mon Jul 09, 2007 4:47 pm
Location: Courthouse

Re: html5 IE gadget project

Post by juror »

No need for thanks. Looks like it will be a fine contribution to PB.
Post Reply