Using WebView with Borland !!!

Re: Using WebView with Borland !!!

Postby Silvio.Falconi » Mon Feb 14, 2022 12:52 pm

Antonio Linares wrote:Por lo visto para Windows 10 hace falta instalar algo que en Windows 11 parece no ser necesario...

Paco, aparte del instalador de EverGreen, te suena haber instalado algo más para probarlo ?



Antonio,
On Windows Seven I have this error
Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: Using WebView with Borland !!!

Postby Antonio Linares » Mon Feb 14, 2022 4:30 pm

Dear Silvio,

It seems as it is not Windows 7 compatible.

I will install a Windows 7 on VirtualBox to check it :-)
regards, saludos

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

Re: Using WebView with Borland !!!

Postby Otto » Mon Feb 14, 2022 5:48 pm

Dear Antonio,

Is it possible to receive data from webview to FIVEWIN?

BTW, this is the same error I get on WINDOWS SERVER 2008 R2.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6334
Joined: Fri Oct 07, 2005 7:07 pm

Re: Using WebView with Borland !!!

Postby Antonio Linares » Mon Feb 14, 2022 7:09 pm

Dear Otto,

> Is it possible to receive data from webview to FIVEWIN?

Yes

> BTW, this is the same error I get on WINDOWS SERVER 2008 R2

There is something else to install, we are trying to identify it
regards, saludos

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

Re: Using WebView with Borland !!!

Postby Silvio.Falconi » Tue Feb 15, 2022 7:24 am

Antonio Linares wrote:Dear Silvio,

It seems as it is not Windows 7 compatible.

I will install a Windows 7 on VirtualBox to check it :-)



I seem run ok on Windows 7
https://docs.microsoft.com/en-us/micros ... /webview2/
Code: Select all  Expand view  RUN
WebView2 benefits

    Web ecosystem and skill set. Utilize the entire web platform, libraries, tooling, and talent that exists within the web ecosystem.

    Rapid innovation. Web development allows for faster deployment and iteration.

    Windows 7, 8, 10, and 11 support. Support for a consistent user experience across Windows 7, Windows 8, Windows 10, and Windows 11.

    Native capabilities. Access the full set of Native APIs.

    Code-sharing. Add web code to your codebase allows for increased reuse across multiple platforms.

    Microsoft support. Microsoft provides support and adds new feature requests when WebView2 releases at General Availability (GA).

    Evergreen distribution. Rely on an up-to-date version of Chromium with regular platform updates and security patches.

    Fixed Version distribution. Optionally package a specific version of the Chromium bits in your app.

    Incremental adoption. Add web components piece-by-piece to your app.

Supported platforms

A General Availability (GA) or Preview version of WebView2 is available for the following programming environments:

    Win32 C/C++ (GA)
    .NET Framework 4.5 or later
    .NET Core 3.1 or later
    .NET 5
    .NET 6
    WinUI 2.0 (Preview)
    WinUI 3.0

WebView2 apps can run on the following versions of Windows:

    Windows 11
    Windows 10
    Windows 10 IoT Enterprise LTSC x32 2019
    Windows 10 IoT Enterprise LTSC x64 2019
    Windows 10 IoT Enterprise 21h1 x64
    Windows 8.1
    Windows 7 **
    Windows Server 2019
    Windows Server 2016
    Windows Server 2012
    Windows Server 2012 R2
    Windows Server 2008 R2 **

**WebView2 support for Windows 7 and Windows Server 2008 R2 have the same support timeline as Microsoft Edge. See Microsoft Edge supported Operating Systems.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: Using WebView with Borland !!!

Postby anserkk » Tue Feb 15, 2022 9:05 am

The following code is working fine with Borland C Compiler via STATIC linking of the DLL. I have added the missing C wrapper definitions.

Code: Select all  Expand view  RUN
#include "FiveWin.ch"
function Main()

   local hWebView := WebView_Create()

   WebView_Navigate( hWebView, Html() ) // or use an URL
   
   SysWait( 2 )
   WebView_Bind( hWebView, "SendToFWH", SendToFWHAddress(), hWebView )    
   
   WebView_Eval( hWebView, 'document.getElementById( "user" ).value = "fivetech"' )
   WebView_Eval( hWebView, 'document.getElementById( "passwd" ).value = "1234"' )
   SysWait( 2 )
   WebView_Eval( hWebView, 'document.getElementById( "submit" ).click()' )
   
   WebView_Run( hWebView )
   WebView_Destroy( hWebView )  

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>
            <form method="post">
               <label for="fname">username:</label>
               <input type="text" id="user" name="username"><br><br>
               <label for="lname">password:</label>
               <input type="text" id="passwd" name="password"><br><br>
               <input type="submit" id="submit" value="Submit" onclick="alert('ok')">
            </form>            
         </body>
      </html>
   ENDTEXT      

return cHtml

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>
#include <hbvm.h>

void * webview_create(int debug, void * window );
void webview_run( void * w );
void webview_navigate( void * w, const char * url );
void webview_destroy( void * w );
void webview_eval( void * w, const char * javascript );
void webview_bind( void * w, const char * name, void * func, void * pvoid );

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 ) );
}

HB_FUNC( WEBVIEW_DESTROY )
{
   webview_destroy( hb_parptr( 1 ) );
}

HB_FUNC( WEBVIEW_BIND )
{
   webview_bind( hb_parptr( 1 ), hb_parc( 2 ), hb_parptr( 3 ), hb_parptr( 4 ) );
}

HB_FUNC( WEBVIEW_EVAL )
{
   webview_eval( hb_parptr( 1 ), hb_parc( 2 ) );
}

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
User avatar
anserkk
 
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Using WebView with Borland !!!

Postby Silvio.Falconi » Tue Feb 15, 2022 9:58 am

anserkk wrote:The following code is working fine with Borland C Compiler via STATIC linking of the DLL. I have added the missing C wrapper definitions.

Code: Select all  Expand view  RUN
#include "FiveWin.ch"
function Main()

   local hWebView := WebView_Create()

   WebView_Navigate( hWebView, Html() ) // or use an URL
   
   SysWait( 2 )
   WebView_Bind( hWebView, "SendToFWH", SendToFWHAddress(), hWebView )    
   
   WebView_Eval( hWebView, 'document.getElementById( "user" ).value = "fivetech"' )
   WebView_Eval( hWebView, 'document.getElementById( "passwd" ).value = "1234"' )
   SysWait( 2 )
   WebView_Eval( hWebView, 'document.getElementById( "submit" ).click()' )
   
   WebView_Run( hWebView )
   WebView_Destroy( hWebView )  

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>
            <form method="post">
               <label for="fname">username:</label>
               <input type="text" id="user" name="username"><br><br>
               <label for="lname">password:</label>
               <input type="text" id="passwd" name="password"><br><br>
               <input type="submit" id="submit" value="Submit" onclick="alert('ok')">
            </form>            
         </body>
      </html>
   ENDTEXT      

return cHtml

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>
#include <hbvm.h>

void * webview_create(int debug, void * window );
void webview_run( void * w );
void webview_navigate( void * w, const char * url );
void webview_destroy( void * w );
void webview_eval( void * w, const char * javascript );
void webview_bind( void * w, const char * name, void * func, void * pvoid );

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 ) );
}

HB_FUNC( WEBVIEW_DESTROY )
{
   webview_destroy( hb_parptr( 1 ) );
}

HB_FUNC( WEBVIEW_BIND )
{
   webview_bind( hb_parptr( 1 ), hb_parc( 2 ), hb_parptr( 3 ), hb_parptr( 4 ) );
}

HB_FUNC( WEBVIEW_EVAL )
{
   webview_eval( hb_parptr( 1 ), hb_parc( 2 ) );
}

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


Imust link any lib ?


Code: Select all  Expand view  RUN
Progetto: test3, Ambiente: bcc7xHarbor:
[1]:Harbour.Exe test3.prg  /m /n0 /gc1 /es2 /a /iC:\work\fwh\include /iC:\work\XHARBOUR\Include /jI18n\Main.hil /iinclude;c:\work\fwh\include;C:\work\XHARBOUR\include /oObj\test3.c
xHarbour 1.2.3 Intl. (SimpLex) (Build 20180217)
Copyright 1999-2017, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'test3.prg'...
Generating international list to 'I18n\Main.hil'...
Generating C source output to 'Obj\test3.c'...
Done.
Lines 45, Functions/Procedures 2, pCodes 158
[1]:Bcc32.Exe -M -c -DHB_OS_WIN_32 -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -IC:\work\fwh\include -IC:\work\bcc7\Include\windows\sdk\;C:\work\XHARBOUR\Include  -nObj Obj\test3.c
Embarcadero C++ 7.30 for Win32 Copyright (c) 1993-2017 Embarcadero Technologies, Inc.
Obj\test3.c:
Warning W8057 test3.prg 96: Parameter 'p' is never used in function SendToFWH
[1]:iLink32.Exe -Gn -aa -Tpe -s -v @test3.bcl
Turbo Incremental Link 6.80 Copyright (c) 1997-2017 Embarcadero Technologies, Inc.
Error: Unresolved external '_webview_create' referenced from C:\WORK\ERRORI\WEBVIEW\OBJ\TEST3.OBJ
Error: Unresolved external '_webview_run' referenced from C:\WORK\ERRORI\WEBVIEW\OBJ\TEST3.OBJ
Error: Unresolved external '_webview_navigate' referenced from C:\WORK\ERRORI\WEBVIEW\OBJ\TEST3.OBJ
Error: Unresolved external '_webview_destroy' referenced from C:\WORK\ERRORI\WEBVIEW\OBJ\TEST3.OBJ
Error: Unresolved external '_webview_bind' referenced from C:\WORK\ERRORI\WEBVIEW\OBJ\TEST3.OBJ
Error: Unresolved external '_webview_eval' referenced from C:\WORK\ERRORI\WEBVIEW\OBJ\TEST3.OBJ
Error: Unable to perform link
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: Using WebView with Borland !!!

Postby anserkk » Tue Feb 15, 2022 10:05 am

Silvio.Falconi wrote: I must link any lib ?

Yes. You have to create Webvew.lib using the impdef and implib process as explained on the first page of this thread.

Regards
Anser
User avatar
anserkk
 
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Using WebView with Borland !!!

Postby Antonio Linares » Tue Feb 15, 2022 3:57 pm

Dear Anser,

great feedback!

many thanks! :-)
regards, saludos

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

Re: Using WebView with Borland !!!

Postby Antonio Linares » Tue Feb 15, 2022 4:04 pm

Dear Anser,

What Windows version are you using ?

What did you had to install to get it running ?

many thanks
regards, saludos

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

Re: Using WebView with Borland !!!

Postby anserkk » Wed Feb 16, 2022 5:38 am

Antonio Linares wrote:What Windows version are you using ?

I am using Windows 10 Pro 64 bit

Antonio Linares wrote:What did you had to install to get it running ?

To get it running, I had to install Evergreen Standalone Installer x86 from the website https://developer.microsoft.com/en-us/microsoft-edge/webview2/

Regards
Anser
User avatar
anserkk
 
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Using WebView with Borland !!!

Postby Silvio.Falconi » Wed Feb 16, 2022 8:42 am

ok Win 10 ok
but is there someome tried on windows Seven ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: Using WebView with Borland !!!

Postby Antonio Linares » Wed Feb 16, 2022 8:59 am

Silvio,

I am having troubles installing Windows 7 on virtualbox, sorry
regards, saludos

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

Re: Using WebView with Borland !!!

Postby Antonio Linares » Wed Feb 16, 2022 8:59 am

regards, saludos

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

Re: Using WebView with Borland !!!

Postby Silvio.Falconi » Wed Feb 16, 2022 10:21 am

Antonio Linares wrote:Silvio,

I am having troubles installing Windows 7 on virtualbox, sorry



Antonio,
On Windows Seven make that error I publish

Image

Today I found this

https://docs.microsoft.com/en-us/window ... esscontext

https://quoramarketing.com/fix-teardown ... not-found/

https://stackoverflow.com/questions/682 ... in-windows

https://docs.microsoft.com/en-us/window ... ss-context

I think there is a solution with

Code: Select all  Expand view  RUN

#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 3

extern BOOL SetProcessDpiAwarenessContext(int value);

int main()

{

   SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);

}


But How I can insert it on my exe ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7066
Joined: Thu Oct 18, 2012 7:17 pm

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 78 guests