#include "FiveWin.ch"
static hDLL
function Main()
local hWebView
hDLL = LoadLibrary( "webview.dll" )
hWebView = WebView_Create( 0, 0 )
WebView_Navigate( hWebView, "https://www.google.com" )
WebView_Run( hWebView )
WebView_Destroy( hWebView )
FreeLibrary( hDLL )
return nil
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
LIBRARY WEBVIEW.DLL
EXPORTS
_webview_bind @1 ; webview_bind
_webview_create @2 ; webview_create
_webview_destroy @3 ; webview_destroy
_webview_dispatch @4 ; webview_dispatch
_webview_eval @5 ; webview_eval
_webview_get_window @6 ; webview_get_window
_webview_init @7 ; webview_init
_webview_navigate @8 ; webview_navigate
_webview_return @9 ; webview_return
_webview_run @10 ; webview_run
_webview_set_size @11 ; webview_set_size
_webview_set_title @12 ; webview_set_title
_webview_terminate @13 ; webview_terminate
function Main()
local hWebView := WebView_Create()
WebView_Navigate( hWebView, "https://www.google.com" )
WebView_Run( hWebView )
return nil
#pragma BEGINDUMP
#include <hbapi.h>
void * webview_create(int debug, void * window );
void webview_run( void * w );
void webview_navigate( void * w, const char * url );
HB_FUNC( WEBVIEW_CREATE )
{
hb_retptr( webview_create( 0, NULL ) );
}
HB_FUNC( WEBVIEW_RUN )
{
webview_run( hb_parptr( 1 ) );
}
HB_FUNC( WEBVIEW_NAVIGATE )
{
webview_navigate( hb_parptr( 1 ), hb_parc( 2 ) );
}
#pragma ENDDUMP
set path=c:\bcc7\bin
c:\harbour\bin\hbmk2 webview.prg -lwebview -comp=bcc
Application Internal Error - C:\fwh16\samples\testwebv.exe
Terminated at: 2021-12-01 09:27:53
Unrecoverable error 6005: Exception error:
Exception Code:C0000005 ACCESS_VIOLATION
Exception Address:6CF6DCC9
EAX:00000000 EBX:00933490 ECX:00000000 EDX:00949278
ESI:6CFEB56C EDI:0019F7E8 EBP:0019F798
CS:EIP:0023:6CF6DCC9 SS:ESP:002B:0019F790
DS:002B ES:002B FS:0053 GS:002B
Flags:00010206
Exception Parameters: 00000000 00000000
CS:EIP: 8B 08 8B 51 0C 89 55 F8 83 7D 08 00 74 0B 8B 45
SS:ESP: 6A9FD134 00000060 0019F7BC 6DF41D2C 00949278 80010106 00000000 00000000 C6AB732E 80010106 0019F7E8 0019F80C 6A81DF62 00933490 80010106 00000000
C stack:
EIP: EBP: Frame: OldEBP, RetAddr, Params...
6CF6DCC9 0019F798 0019F7BC 6DF41D2C 00949278 80010106 00000000 00000000 C6AB732E 80010106 0019F7E8
6DF41D2C 0019F7BC 0019F80C 6A81DF62 00933490 80010106 00000000 00000000 2E83C480 00000037 00933490 00000000
6A81DF62 0019F80C 0019F848 6A7CD063 00000000 009525B8 00000000 00933490 00000000 2E89C5A0 0000002D 80000030
6A7CD063 0019F848 0019F86C 6DF4265D 00000001 00000000 009525B8 00000000 00933490 009525B8 00000000
6DF4265D 0019F86C 0019F8A8 6DF41343 0093DE48 00000001 00000000 009525B8 00000000 00933490 0000006E 0000006E
6DF41343 0019F8A8 0019F8CC 6DF41D0A 00000000 00000000 00933490 6A8F9B01 C6AB7C5E 80010106 0019F8F8
6DF41D0A 0019F8CC 0019F920 6A81DF62 00933490 80010106 00000000 00000000 0019F93C 00933490 00933490 00000000
6A81DF62 0019F920 0019F95C 6A7CD063 00000000 009525B8 00000000 00933490 00000000 2E89C600 0000002D 80000030
6A7CD063 0019F95C 0019F980 6DF4265D 00000001 00000000 009525B8 00000000 00933490 009525B8 00000000
6DF4265D 0019F980 0019F9BC 6DF41343 0094BED0 00000001 00000000 009525B8 00000000 00933490 0000006E 0000006E
6DF41343 0019F9BC 0019FA30 6DF4129C 00000000 00000000 00933490 00586115 6CF70B56 0019FB28 0019F9F4 00000000
6DF4129C 0019FA30 0019FC84 6CF73588 00000000 009525B8 00000000 00949278 42C53424 0019FC94 00904B98 0019FAB8
6CF73588 0019FC84 0019FD74 6CF6995F 019A0B76 00000000 6CFEBCA0 6CF6B87C 0019FD84 00933340 0019FD74 6CF6990B
6CF6995F 0019FD74 0019FD98 6CF696D7 00000000 00000000 42C53538 00933340 0019FF60 6CFAF0DD FFFFFFFF
6CF696D7 0019FD98 0019FDBC 6CF61090 00000000 00000000 0019FDC8 00000000 00586115 00933340 00753BA0
6CF61090 0019FDBC 0019FDE4 004015ED 00000000 00000000 004A0BF0 00000001 00000000 00000000 00000000 00000000
004015ED 0019FDE4 0019FEF8 0049A9FA 00000000 00401458 00000001 006F6F00 00003E88 006F74AC 024EFCE4 00753F0C
0049A9FA 0019FEF8 0019FF20 004015E0 0058610C 005860C8 004A0BF0 00000000 00000000 00000000 00000000 00000003
004015E0 0019FF20 0019FF34 00499CCC 00000000 00586048 008F3AE8
00499CCC 0019FF34 0019FF40 004CBF36 00000001
Modules:
00400000 00382000 C:\fwh16\samples\testwebv.exe
77A00000 001A3000 C:\WINDOWS\SYSTEM32\ntdll.dll
75930000 000F0000 C:\WINDOWS\System32\KERNEL32.DLL
76F90000 00214000 C:\WINDOWS\System32\KERNELBASE.dll
75D60000 0007A000 C:\WINDOWS\System32\ADVAPI32.DLL
762C0000 000BF000 C:\WINDOWS\System32\msvcrt.dll
6CF60000 000AB000 C:\fwh16\samples\WEBVIEW.DLL
75CB0000 00075000 C:\WINDOWS\System32\sechost.dll
75B10000 000BF000 C:\WINDOWS\System32\RPCRT4.dll
76CC0000 001A0000 C:\WINDOWS\System32\USER32.dll
75F70000 00018000 C:\WINDOWS\System32\win32u.dll
6DF40000 00020000 C:\fwh16\samples\WebView2Loader.dll
76F60000 00024000 C:\WINDOWS\System32\GDI32.dll
77940000 000AF000 C:\WINDOWS\System32\COMDLG32.DLL
75DF0000 000DC000 C:\WINDOWS\System32\gdi32full.dll
76390000 00281000 C:\WINDOWS\System32\combase.dll
76680000 0007B000 C:\WINDOWS\System32\msvcp_win.dll
76040000 00120000 C:\WINDOWS\System32\ucrtbase.dll
75C60000 00045000 C:\WINDOWS\System32\SHLWAPI.dll
75FB0000 00087000 C:\WINDOWS\System32\shcore.dll
75ED0000 00096000 C:\WINDOWS\System32\OLEAUT32.dll
77320000 005B3000 C:\WINDOWS\System32\SHELL32.dll
757B0000 00008000 C:\WINDOWS\SYSTEM32\VERSION.DLL
75A20000 000E3000 C:\WINDOWS\System32\OLE32.DLL
6DCB0000 0008D000 C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.19041.1110_none_c0da534e38c01f4d\COMCTL32.DLL
75730000 00072000 C:\WINDOWS\SYSTEM32\WINSPOOL.DRV
717B0000 00006000 C:\WINDOWS\SYSTEM32\MSIMG32.DLL
71B40000 00028000 C:\WINDOWS\SYSTEM32\WINMM.DLL
6DF10000 0002C000 C:\WINDOWS\SYSTEM32\OLEDLG.DLL
717C0000 00169000 C:\WINDOWS\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.1348_none_d94f9953e1060d01\GDIPLUS.DLL
75D30000 00025000 C:\WINDOWS\System32\IMM32.DLL
70BA0000 00074000 C:\WINDOWS\system32\uxtheme.dll
76160000 000D3000 C:\WINDOWS\System32\MSCTF.dll
75010000 0000F000 C:\WINDOWS\SYSTEM32\kernel.appcore.dll
75C00000 0005F000 C:\WINDOWS\System32\bcryptPrimitives.dll
6F8C0000 000B9000 C:\WINDOWS\SYSTEM32\textinputframework.dll
6F640000 0027E000 C:\WINDOWS\System32\CoreUIComponents.dll
6F5A0000 0009B000 C:\WINDOWS\System32\CoreMessaging.dll
758C0000 00063000 C:\WINDOWS\System32\WS2_32.dll
729E0000 00029000 C:\WINDOWS\SYSTEM32\ntmarta.dll
6F4C0000 000DB000 C:\WINDOWS\SYSTEM32\wintypes.dll
6A7A0000 002CE000 C:\Program Files (x86)\Microsoft\EdgeWebView\Application\96.0.1054.41\EBWebView\x86\EmbeddedBrowserWebView.dll
728C0000 0000A000 C:\WINDOWS\SYSTEM32\CRYPTBASE.DLL
Called from WEBVIEW_CREATE(0)
Called from MAIN(3) in testwebv.prg
------------------------------------------------------------------------
#include "FiveWin.ch"
static hDLL
function Main()
local hWebView
hDLL = LoadLibrary( "webview.dll" )
hWebView = WebView_Create( 0, 0 )
WebView_Navigate( hWebView, "https://www.fivetechsoft.com/test.html" )
WebView_Bind( hWebView, "test", Test(), hWebView )
WebView_Run( hWebView )
WebView_Destroy( hWebView )
FreeLibrary( hDLL )
return nil
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
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
static void test( const char * x, const char * y, void * t )
{
MessageBox( 0, "OK", "OK", 0 );
}
HB_FUNC( TEST )
{
hb_retnl( ( HB_LONG ) test );
}
#pragma ENDDUMP
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<button onclick="test()">test</button>
</body>
</html>
#include "FiveWin.ch"
static hDLL
function Main()
local hWebView
hDLL = LoadLibrary( "webview.dll" )
hWebView = WebView_Create( 0, 0 )
WebView_Navigate( hWebView, "https://www.fivetechsoft.com/test.html" )
WebView_Eval( hWebView, 'document.body.style.backgroundColor = "blue"' )
WebView_Bind( hWebView, "test", Test(), hWebView )
WebView_Run( hWebView )
WebView_Destroy( hWebView )
FreeLibrary( hDLL )
return nil
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 )
{
// void * wv = t;
// printf( "params:[%s],[%s],[%p]", x, y, t );
// webview_terminate( wv );
MessageBox( 0, "OK", "OK", 0 );
}
HB_FUNC( TEST )
{
hb_retnl( ( HB_LONG ) test );
}
#pragma ENDDUMP
#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_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
#include "FiveWin.ch"
static hDLL, s_nCalls, s_cJsonResult
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_Eval( hWebView, 'document.body.style.backgroundColor = "blue"' )
WebView_Bind( hWebView, "SendToFWH", SendToFWHAddress(), hWebView )
WebView_Run( hWebView )
WebView_Destroy( hWebView )
FreeLibrary( hDLL )
return nil
function WebView_SaveValues( cCalls, cJsonResult )
s_nCalls = Val( cCalls )
s_cJsonResult = cJsonResult
MsgInfo( s_nCalls, s_cJsonResult )
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='SendToFWH( 123 )'>Call FWH app from web browser</button>
<button onclick='SendToFWH( 456 )'>Test 2</button>
<button onclick='SendToFWH( 123, 456, "yes it works!" )'>Test 3</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>
#include <hbvm.h>
static void SendToFWH( const char * szNumRequests, const char * szJson, void * p )
{
hb_vmPushSymbol( hb_dynsymGetSymbol( "WEBVIEW_SAVEVALUES" ) );
hb_vmPushNil();
hb_vmPushString( szNumRequests, strlen( szNumRequests ) );
hb_vmPushString( szJson, strlen( szJson ) );
hb_vmFunction( 2 );
}
HB_FUNC( SENDTOFWHADDRESS )
{
hb_retnl( ( HB_LONG ) SendToFWH );
}
#pragma ENDDUMP
Antonio Linares wrote:Hakan,
> Can we test WebView using msvc?
yes, only 32 bits for now. But surely we will get it working on 64 bits too.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 53 guests