It is currently Tue Sep 18, 2018 8:36 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: html5 IE gadget project
PostPosted: Wed Jun 13, 2018 9:07 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3314
Location: New Zealand
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

_________________
Got winter blues?
Enjoy a Caravan Trip into, "The Land of Grey and Pink", wine and punk weed optional!
https://www.youtube.com/watch?v=9hmFzGTxod4


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Wed Jun 13, 2018 10:24 am 
Online
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4255
Location: Lyon - France
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


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Wed Jun 13, 2018 10:46 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3314
Location: New Zealand
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.

_________________
Got winter blues?
Enjoy a Caravan Trip into, "The Land of Grey and Pink", wine and punk weed optional!
https://www.youtube.com/watch?v=9hmFzGTxod4


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Wed Jun 13, 2018 10:56 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat May 05, 2007 5:31 pm
Posts: 475
Location: Linz, Austria
Finally :P
Image

Works on Win7 x64 (SP1) with PB 5.70b1 x86! Keep up the good work ^^


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Wed Jun 13, 2018 11:08 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3314
Location: New Zealand
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:

_________________
Got winter blues?
Enjoy a Caravan Trip into, "The Land of Grey and Pink", wine and punk weed optional!
https://www.youtube.com/watch?v=9hmFzGTxod4


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Wed Jun 13, 2018 11:15 am 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 02, 2004 1:20 pm
Posts: 975
Location: Amphibios 9
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

_________________
Can't decide if i need a hug, an XXL coffee, 6 shots of vodka or 2 weeks of sleep.


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Wed Jun 13, 2018 11:26 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3314
Location: New Zealand
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>

_________________
Got winter blues?
Enjoy a Caravan Trip into, "The Land of Grey and Pink", wine and punk weed optional!
https://www.youtube.com/watch?v=9hmFzGTxod4


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Thu Jun 14, 2018 2:10 pm 
Online
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4255
Location: Lyon - France
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


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Thu Jun 14, 2018 5:48 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Jul 09, 2007 4:47 pm
Posts: 214
Location: Courthouse
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


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Thu Jun 14, 2018 10:11 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3314
Location: New Zealand
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

_________________
Got winter blues?
Enjoy a Caravan Trip into, "The Land of Grey and Pink", wine and punk weed optional!
https://www.youtube.com/watch?v=9hmFzGTxod4


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Thu Jun 14, 2018 10:40 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Jul 09, 2007 4:47 pm
Posts: 214
Location: Courthouse
"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/hypers ... ery.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)


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Fri Jun 15, 2018 2:23 am 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3314
Location: New Zealand
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:
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()


_________________
Got winter blues?
Enjoy a Caravan Trip into, "The Land of Grey and Pink", wine and punk weed optional!
https://www.youtube.com/watch?v=9hmFzGTxod4


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Fri Jun 15, 2018 2:49 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Jul 09, 2007 4:47 pm
Posts: 214
Location: Courthouse
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


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Fri Jun 15, 2018 11:24 pm 
Offline
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3314
Location: New Zealand
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.

_________________
Got winter blues?
Enjoy a Caravan Trip into, "The Land of Grey and Pink", wine and punk weed optional!
https://www.youtube.com/watch?v=9hmFzGTxod4


Top
 Profile  
Reply with quote  
 Post subject: Re: html5 IE gadget project
PostPosted: Sat Jun 16, 2018 3:06 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Jul 09, 2007 4:47 pm
Posts: 214
Location: Courthouse
No need for thanks. Looks like it will be a fine contribution to PB.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye