Using WebView with Borland !!!

Using WebView with Borland !!!

Postby Antonio Linares » Tue Nov 30, 2021 10:16 pm

We have been able to easily make WebView2 work with Borland :-)

Just wondering if there is interest about this...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using WebView with Borland !!!

Postby cmsoft » Tue Nov 30, 2021 11:15 pm

Por supuesto!!!
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Using WebView with Borland !!!

Postby Antonio Linares » Wed Dec 01, 2021 8:33 am

Ok, for those of you that want to start testing and using it, here we go:

I prefer to use dynamic linking so we don't force all FWH users to distribute webview DLLs. This code is working fine using MSVC and MinGW, but
it is failing with Borland thus Borland works fine when we use static linking (explained on this post also). Thats why we need your feedback:

webview.prg
Code: Select all  Expand view
#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


webview.dll must be downloaded from here:
https://github.com/webview/webview/tree/master/dll/x86
https://github.com/webview/webview/tree/master/dll/x64

and webview2 has to be installed from here:
https://developer.microsoft.com/en-us/microsoft-edge/webview2/

WebView2Loader.dll correct size is 326.552. The ones distributed in https://github.com/webview/webview/tree/master/dll are smaller (probably older), but the provided webview.dll is correct.

Simply copy the above webview.prg to FWH\samples and do buildh32.bat webview for MSVC and buildg.bat webview for MinGW. If you do a buildh.bat webview you will see that it crashes after building the webview but you can see it. Still wondering why.

But Borland works fine if we do a static linking this way:

1. We create the .DEF file of webview.dll this way:

impdef.exe webview.def webview.dll

2. We need to modify webview.def this way (please notice the underscores in front of the names):
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


Now we create the import library (webview.lib) this way from the above .def file:
implib.exe webview.lib webview.def

Here you have webview.prg for static linking for Borland:
Code: Select all  Expand view
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


to build it simply do:
set path=c:\bcc7\bin
c:\harbour\bin\hbmk2 webview.prg -lwebview -comp=bcc


and you will get your EXE working properly with Borland (but using static linking)

Once we get your feedback, we will turn this into a FWH control that you can place anywhere in your app (window, dialog, control)

Please notice that there are some other functions in the .DEF file that we have not implemented yet, but are quite simply to be implemented following the above example.

Welcome to the magic of webview for all :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using WebView with Borland !!!

Postby cmsoft » Wed Dec 01, 2021 12:30 pm

Antonio:
Pude generar sin errores el exe
Se lanza pero se cierra.
Este es el log
Code: Select all  Expand view

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
------------------------------------------------------------------------
 
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Using WebView with Borland !!!

Postby Antonio Linares » Wed Dec 01, 2021 5:48 pm

César,

Has probado el enlace dinámico (uso de webview.dll) ó el estático (uso de webview.lib) ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using WebView with Borland !!!

Postby leandro » Thu Dec 02, 2021 11:22 am

Buena noticia :D :D :D

En unos días que termine un asunto prioritario, referente a la nomina electrónica, intentare usar este nuevo elemento.

Saludos

LEANDRO AREVALO
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1481
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Using WebView with Borland !!!

Postby cmsoft » Fri Dec 03, 2021 2:01 pm

El estatico Antonio!
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Using WebView with Borland !!!

Postby Antonio Linares » Sat Jan 29, 2022 8:44 pm

Implementing the "bind" from javascript to our FWH app:

to build it, from FWH\samples do:
buildh32.bat webview

webview.prg
Code: Select all  Expand view
#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


test.html
Code: Select all  Expand view
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

    <button onclick="test()">test</button>
</body>
</html>


when you click on the "test" button (javacript code), low level C test() in our FWH app will be executed!
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using WebView with Borland !!!

Postby Antonio Linares » Sat Jan 29, 2022 9:39 pm

Implementing WebView_Eval( hWebView, cJavaScript )

webview.prg
Code: Select all  Expand view
#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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using WebView with Borland !!!

Postby Antonio Linares » Sun Jan 30, 2022 8:48 am

Getting closer to what we are looking for :-)

Download it and test it from here:
https://github.com/FiveTechSoft/FWH_tools/raw/master/webview.zip

if you want to build it, from FWH\samples:
buildh32.bat webview

webview.prg
Code: Select all  Expand view
#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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using WebView with Borland !!!

Postby Antonio Linares » Sun Jan 30, 2022 10:52 am

Easier to understand implementation:

webview.prg
Code: Select all  Expand view
#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


Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using WebView with Borland !!!

Postby Antonio Linares » Sun Jan 30, 2022 11:15 am

Using this technique we are going to do unitary tests on web apps :-)

Next example will help you to see it much clearer, when you see a web app being used "automatically" without user intervention
and checking for itself if it is working as expected or not

Basically from our Harbour app, we load a web app and automatically start filling what is required and checking the results we get.
From Harbour we execute JavaScript using webview_eval() and from JavaScript we return the values to our Harbour app
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using WebView with Borland !!!

Postby Horizon » Sun Jan 30, 2022 12:18 pm

Hi Antonio,

Can we test WebView using msvc?

Thanks.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: Using WebView with Borland !!!

Postby Antonio Linares » Sun Jan 30, 2022 6:03 pm

Hakan,

> Can we test WebView using msvc?

yes, only 32 bits for now. But surely we will get it working on 64 bits too.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Using WebView with Borland !!!

Postby Horizon » Sun Jan 30, 2022 6:11 pm

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.


That's enough.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests