by Natter » Thu May 26, 2022 12:37 pm
#include "FiveWin.ch"
static hDLL
function Main()
local hWebView
hDLL = LoadLibrary( "webview.dll" )
hWebView = WebView_Create( 0, 0 )
* WebView_Navigate( hWebView, Html() ) // or use a URL like "https://www.fivetechsoft.com/test.html" )
WebView_Navigate( hWebView, "https://www.fivetechsoft.com" )
// WebView_Eval( hWebView, 'document.body.style.backgroundColor = "blue"' )
WebView_Bind( hWebView, "test", Test(), hWebView )
WebView_Run( hWebView )
WebView_Destroy( hWebView )
FreeLibrary( hDLL )
return nil
function Html()
local cHtml
TEXT INTO cHtml
data:text/html,
<html>
<head>
</head>
<body style="background-color:cyan">
<h2>Using WebView from FWH</h2>
<button onclick='test( 123, "Hello" )'>Call FWH app from web browser</button>
</body>
</html>
ENDTEXT
return cHtml
DLL FUNCTION WEBVIEW_CREATE( nDebug AS LONG, hWndParent AS LONG ) AS LONG PASCAL FROM "webview_create" LIB hDLL
DLL FUNCTION WEBVIEW_RUN( hWebView AS LONG ) AS VOID PASCAL FROM "webview_run" LIB hDLL
DLL FUNCTION WEBVIEW_NAVIGATE( hWebView AS LONG, cUrl AS LPSTR ) AS VOID PASCAL FROM "webview_navigate" LIB hDLL
DLL FUNCTION WEBVIEW_DESTROY( hWebView AS LONG ) AS VOID PASCAL FROM "webview_destroy" LIB hDLL
DLL FUNCTION WEBVIEW_BIND( hWebView AS LONG, cName AS LPSTR, pFunc AS LONG, pVoid AS LONG ) AS VOID PASCAL FROM "webview_bind" LIB hDLL
DLL FUNCTION WEBVIEW_EVAL( hWebView AS LONG, cJavaScript AS LPSTR ) AS VOID PASCAL FROM "webview_eval" LIB hDLL
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
static void test( const char * x, const char * y) //, void * t )
{
MessageBox( 0, x, y, 0 );
}
HB_FUNC( TEST )
{
hb_retnl( ( HB_LONG ) test );
}
#pragma ENDDUMP