Page 3 of 3
Re: IE
Posted: Sat Jun 04, 2022 10:32 am
by Natter
Antonio, excuse me, I sent you an html file by email.
hb_DynCall( { "webview_navigate", pLib, ;
hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysCallConv() ),;
HB_DYN_CTYPE_VOID_PTR, HB_DYN_CTYPE_CHAR_PTR },;
hWebView, "data:text/html,"+CRLF+filestr("my.html"))
Re: IE
Posted: Sat Jun 04, 2022 11:21 pm
by Antonio Linares
Dear Yuri,
If you upload your HTML file to your hosting server and then use webview to navigate to it, it works fine. I just tested it.
But if we try to load it reading the file, then it crashes. Not sure why. We have noticed that with other HTML files too and still we
are wondering why.
Re: IE
Posted: Sat Jun 04, 2022 11:23 pm
by Antonio Linares
In webview docs we find this:
// Navigates webview to the given URL. URL may be a properly encoded data URI.
// Examples:
// webview_navigate(w, "https://github.com/webview/webview");
// webview_navigate(w, "data:text/html,%3Ch1%3EHello%3C%2Fh1%3E");
// webview_navigate(w, "data:text/html;base64,PGgxPkhlbGxvPC9oMT4=");
Please notice that the HTML contents seems to be encoded. Maybe thats required.
Re: IE
Posted: Sat Jun 04, 2022 11:34 pm
by Antonio Linares
Solved

oWebView:Navigate( "data:text/html;base64," + hb_base64Encode( hb_memoRead( "my.html" ) ) )
Re: IE
Posted: Sun Jun 05, 2022 8:28 am
by Natter
Antonio, thank you, the html file is loading normally. Only in webview, map rendering is much slower than in IE.
I tried to embed a webview object in a window. According to the documentation, the second webview_create parameter should be replaced with the window handle. However, it didn't work
Code: Select all | Expand
function Main()
private pLib := hb_LibLoad( "webview.dll" )
private oWnd
DEFINE DIALOG oWnd TITLE "FWH desktop app" SIZE 1000, 600
ACTIVATE DIALOG oWnd ON INIT CreateWebView() CENTER
hb_LibFree( pLib )
return NIL
function CreateWebView
local hWebView
hWebView := hb_DynCall( { "webview_create", pLib, ;
hb_bitOr( HB_DYN_CTYPE_VOID_PTR, hb_SysCallConv() ), ;
HB_DYN_CTYPE_VOID_PTR, hb_SysLong(), HB_DYN_CTYPE_VOID_PTR }, ;
oWnd:hWnd, 0)
hb_DynCall( { "webview_navigate", pLib, ;
hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysCallConv() ),;
HB_DYN_CTYPE_VOID_PTR, HB_DYN_CTYPE_CHAR_PTR },;
hWebView, "data:text/html;base64,"+ ;
hb_base64Encode(hb_memoread("my.html")))
hb_DynCall( { "webview_run", pLib, ;
hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysCallConv() ), ;
HB_DYN_CTYPE_VOID, HB_DYN_CTYPE_VOID_PTR }, hWebView )
return nil
Re: IE
Posted: Mon Jun 06, 2022 6:21 am
by Antonio Linares
You have to supply 0, 0 to WebView_Create(). It does not work using params there
But you can make it child of any other window using SetParent( webview_get_window( hWebView ), hWndParent )
Re: IE
Posted: Mon Jun 06, 2022 11:33 am
by Natter
Harbour doesn't understand this syntax:
webview_get_window( hWebView )
I tried to read the window handle, but I get empty.
hWebView := hb_DynCall( { "webview_create", pLib, ;
hb_bitOr( HB_DYN_CTYPE_VOID_PTR, hb_SysCallConv() ), ;
HB_DYN_CTYPE_VOID_PTR, hb_SysLong(), HB_DYN_CTYPE_VOID_PTR }, 0, 0)
hWb:=hb_DynCall( { "webview_get_window", pLib, ;
hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysCallConv() ), ;
HB_DYN_CTYPE_VOID, HB_DYN_CTYPE_VOID_PTR }, hWebView )
Re: IE
Posted: Mon Jun 06, 2022 6:46 pm
by Antonio Linares
Dear Yuri,
You need the new Class TWebView. It properly works with Borland, Microsoft, MinGW and xHarbour too
Its going to be available in a few days with the new FWH 22.06 version
Re: IE
Posted: Tue Jun 07, 2022 3:55 am
by Natter
Is it possible to install webview 2 runtime under Linux ?
Re: IE
Posted: Tue Jun 07, 2022 5:16 am
by Antonio Linares
From
https://github.com/webview/webview:
It uses Cocoa/WebKit on macOS, gtk-webkit2 on Linux and Edge on Windows 10.
So it seems as it also works on Linux. I haven't tried it on Linux yet