#include "FiveWin.ch"
#include "hbdyn.ch"
#define SW_HIDE 0
#define SW_SHOW 5
#define GWL_STYLE -16
STATIC pLib, hWebView
function Main()
local oWnd, oBot, cUrl := "https://app.pedidosbcn.com/tienda/tiendadepizzas"
hWebView := ARRAY(2)
pLib := hb_LibLoad( "webview.dll" )
DEFINE DIALOG oWnd TITLE "FWH WebView" SIZE 1200,500
@ 05,05 BUTTON oBot PROMPT "Formato Web" ACTION CreateWebView(oWnd,cUrl,1) SIZE 50,12 PIXEL
@ 25,05 BUTTON oBot PROMPT "Formato movil" ACTION CreateWebView(oWnd,cUrl,2,350) SIZE 50,12 PIXEL
ACTIVATE DIALOG oWnd CENTER
hb_LibFree( pLib )
return nil
function CreateWebView(oWnd,cUrl, n, nAncho)
local hWnd, nStyle, nOtra := IF(n = 1,2,1)
DEFAULT nAncho := oWnd:nWidth - 2
oWnd:SetSize( if(n==2,500,1200), 500 )
IF !hWebView[nOtra] == nil
hWnd := hb_DynCall( { "webview_get_window", pLib, hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysLong() ),;
HB_DYN_CALLCONV_CDECL,;
HB_DYN_CTYPE_LONG_UNSIGNED }, hWebView[nOtra] )
ShowWindow( hWnd, SW_HIDE )
oWnd:Refresh()
ENDIF
IF !hWebView[n] == nil
hWnd := hb_DynCall( { "webview_get_window", pLib, hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysLong() ),;
HB_DYN_CALLCONV_CDECL,;
HB_DYN_CTYPE_LONG_UNSIGNED }, hWebView[n] )
ShowWindow( hWnd, SW_SHOW )
oWnd:Refresh()
RETURN nil
ENDIF
hWebView[n] := 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)
hWnd := hb_DynCall( { "webview_get_window", pLib, hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysLong() ),;
HB_DYN_CALLCONV_CDECL,;
HB_DYN_CTYPE_LONG_UNSIGNED }, hWebView[n] )
ShowWindow( hWnd, SW_HIDE )
nStyle := GetWindowLong( hWnd, GWL_STYLE )
nStyle -= WS_CAPTION
nStyle -= WS_SYSMENU
nStyle += WS_THICKFRAME
SetWindowLong( hWnd, GWL_STYLE, nStyle )
SetParent( hWnd, oWnd:hWnd )
SetWindowPos( hWnd, nil, 1,120, nAncho, oWnd:nHeight - 2, 0 )
ShowWindow( hWnd, SW_SHOW )
oWnd:Refresh()
hb_DynCall( { "webview_navigate", pLib, hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysCallConv() ),;
HB_DYN_CTYPE_VOID_PTR, HB_DYN_CTYPE_CHAR_PTR },;
hWebView[n], cUrl )
/*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
function hb_SysLong()
return If( hb_OSIS64BIT(), HB_DYN_CTYPE_LLONG_UNSIGNED, HB_DYN_CTYPE_LONG_UNSIGNED )
function hb_SysCallConv()
return If( ! "Windows" $ OS(), HB_DYN_CALLCONV_CDECL, HB_DYN_CALLCONV_STDCALL )