TWebView:Destroy method does not close the window.
- Antonio Linares
- Site Admin
- Posts: 42597
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 40 times
- Been thanked: 86 times
- Contact:
Re: TWebView:Destroy method does not close the window.
Dear Giovany,
Do you use it from a MDI environment as the posted examples ?
Do you use it from a MDI environment as the posted examples ?
- Giovany Vecchi
- Posts: 223
- Joined: Mon Jun 05, 2006 9:39 pm
- Location: Brasil
Re: TWebView:Destroy method does not close the window.
Hi Antonio, In this example I'm using it, but it also works without being MDI.
Download the link or look at the sources.
Download the link or look at the sources.
- Antonio Linares
- Site Admin
- Posts: 42597
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 40 times
- Been thanked: 86 times
- Contact:
Re: TWebView:Destroy method does not close the window.
Dear Giovany,
Many thanks for your example.
In your PRGs I don't see any MDICHILD window being created with a WebView inside
Many thanks for your example.
In your PRGs I don't see any MDICHILD window being created with a WebView inside
- Giovany Vecchi
- Posts: 223
- Joined: Mon Jun 05, 2006 9:39 pm
- Location: Brasil
Re: TWebView:Destroy method does not close the window.
Open WebView.prg on line 33 and put 'MDICHILD' then in the Samples menu call 'Test with Fivewin window' which will open a fivewin child window with webview2 handle
Code: Select all | Expand
FUNCTION WEB_VIEW_TST_WND_FW()
Local lc_oWndTst
Local lc_oWebViewFw
DEFINE WINDOW lc_oWndTst FROM 100, 100 TO 768, 1024 ;
PIXEL ;
TITLE "Teste WebView2" MDICHILD
lc_oWndTst:bInit := <||
lc_oWebViewFw := WebViewFw():New(lc_oWndTst)
lc_oWebViewFw:WebViewFw_Start()
lc_oWebViewFw:WebViewFw_Navigate("http://www.google.com.br")
lc_oWebViewFw:WebViewFw_Run()
Return Nil
>// cEnd
lc_oWndTst:bValid := <||
lc_oWebViewFw:End()
Return .T.
>//cEnd
ACTIVATE WINDOW lc_oWndTst NORMAL
RETURN NIL
Re: TWebView:Destroy method does not close the window.
Hi Antonio,
Can you please to help me to create wrapper WebView_Terminate for msvc? It is in WebView.dll but I could not access.
Thanks.
Can you please to help me to create wrapper WebView_Terminate for msvc? It is in WebView.dll but I could not access.
Thanks.
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
- Antonio Linares
- Site Admin
- Posts: 42597
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 40 times
- Been thanked: 86 times
- Contact:
Re: TWebView:Destroy method does not close the window.
Dear Hakan,
I have already implemented it. I send you the libs this evening, I have to go now...
Do you need them for MSVC 32 bits ?
I have already implemented it. I send you the libs this evening, I have to go now...
Do you need them for MSVC 32 bits ?
Re: TWebView:Destroy method does not close the window.
Antonio Linares wrote:Dear Hakan,
I have already implemented it. I send you the libs this evening, I have to go now...
ok
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
- Antonio Linares
- Site Admin
- Posts: 42597
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 40 times
- Been thanked: 86 times
- Contact:
Re: TWebView:Destroy method does not close the window.
Antonio Linares wrote:msvc 32 bits ?
yes
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Re: TWebView:Destroy method does not close the window.
Horizon wrote:Antonio Linares wrote:msvc 32 bits ?
yes
and TWebView class if you have changed.
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
- Antonio Linares
- Site Admin
- Posts: 42597
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 40 times
- Been thanked: 86 times
- Contact:
Re: TWebView:Destroy method does not close the window.
Hi Antonio,
Has our WEBVIEW_CREATE(,::oWndDlgContainer:hWnd) function container dialog parameter?
Has our WEBVIEW_CREATE(,::oWndDlgContainer:hWnd) function container dialog parameter?
Code: Select all | Expand
void * webview_create(int debug, void * window );
Code: Select all | Expand
// Creates a new webview instance. If debug is non-zero - developer tools will
// be enabled (if the platform supports them). Window parameter can be a
// pointer to the native window handle. If it's non-null - then child WebView
// is embedded into the given parent window. Otherwise a new window is created.
// Depending on the platform, a GtkWindow, NSWindow or HWND pointer can be
// passed here.
HB_FUNC( WEBVIEW_CREATE )
{
INT iDebug = ( INT ) 1 ;
HWND hWnd = ( HWND ) fw_parH(2) ;
if ( HB_ISNUM( 2 ) )
hb_retptr( webview_create( iDebug , &hWnd ));
else
hb_retptr( webview_create( iDebug , 0 ));
}
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
- Antonio Linares
- Site Admin
- Posts: 42597
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 40 times
- Been thanked: 86 times
- Contact:
Re: TWebView:Destroy method does not close the window.
Dear Hakan,
I have already implemented it though using a different code from yours:
In Class TWebView:
I am emailing you the modified libs
I have already implemented it though using a different code from yours:
Code: Select all | Expand
HB_FUNC( WEBVIEW_CREATE )
{
if( ! hDLL )
hDLL = LoadLibrary( "webview.dll" );
if( ! hDLL )
{
MessageBox( 0, "Could not load webview.dll", "Error", MB_OK | MB_ICONERROR );
hb_ret();
}
else
{
HWND hWnd = ( HWND ) hb_parnll( 2 );
if( hWnd != 0 )
hb_retptr( ( ( webview_create * ) GetProcAddress( hDLL, "webview_create" ) )( hb_parnl( 1 ), &hWnd ) );
else
hb_retptr( ( ( webview_create * ) GetProcAddress( hDLL, "webview_create" ) )( hb_parnl( 1 ), 0 ) );
}
}
In Class TWebView:
Code: Select all | Expand
METHOD New( nDebug, hWndParent ) INLINE ( ::hWebView := WebView_Create( nDebug, hWndParent ), AAdd( aWebViews, Self ), Self )
I am emailing you the modified libs
Re: TWebView:Destroy method does not close the window.
Thank you Antonio,
With this last change, TWebView is easier to control.
With this last change, TWebView is easier to control.
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oWnd, oBar
public pb_oWebView
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar 3D OF oWnd SIZE 60, 60
DEFINE BUTTON PROMPT "Open Google" OF oBar ACTION (Open_Google( oWnd ))
DEFINE BUTTON PROMPT "Close Google" OF oBar ACTION Close_Google(oWnd)
ACTIVATE WINDOW oWnd
return nil
function Open_Google( oWnd )
LOCAL cHtml:="https://www.google.com/"
local oWndChild, oWebView
IF !EMPTY(pb_oWebView)
MsgAlert("There is already WINDOW")
return
ENDIF
DEFINE WINDOW oWndChild TITLE "My Test FW Window_"+TIME() ;
FROM 100, 100 TO 768, 1024 PIXEL
oWndChild:bInit := <||
oWebView := TOB_WebView():New(oWndChild)
oWebView:Navigate(cHtml)
oWebView:Run() // We dont need when oWndChild
pb_oWebView := oWebView
Return Nil
>
oWndChild:bValid := <||
oWebView:Destroy()
Return .T.
>
ACTIVATE WINDOW oWndChild
return nil
PROCEDURE Close_Google(oWnd)
LOCAL oWebView := pb_oWebView
If EMPTY(pb_oWebView)
MsgAlert("There is NOT any WINDOW")
return
ENDIF
If !HB_ISNIL(oWebView:oWndDlgContainer)
oWebView:oWndDlgContainer:End()
pb_oWebView:=nil
EndIf
return nil
*------------------------------------------------------------------------------------------
CLASS TOB_WebView FROM TWebView
Data oWndDlgContainer
METHOD New(oWndDlgContainer) Constructor
Method Run()
ENDCLASS
METHOD New(oWndDlgContainer) CLASS TOB_WebView
Local lc_lLoopReSize := .F.
::oWndDlgContainer := oWndDlgContainer
If !Hb_IsNil(::oWndDlgContainer)
::hWebView := WEBVIEW_CREATE(,::oWndDlgContainer:hWnd)
::oWndDlgContainer:bResized := <||
If !lc_lLoopReSize
lc_lLoopReSize := .T.
hb_idleSleep(.001)
::SetSize(::oWndDlgContainer:nWidth,;
::oWndDlgContainer:nHeight,0)
lc_lLoopReSize := .F.
EndIf
Return Nil
>
Else
::hWebView := WEBVIEW_CREATE()
EndIf
RETURN Self
Method Run() Class TOB_WebView
IF HB_ISNIL(::oWndDlgContainer)
If !::lStartRun
::super:Run()
EndIf
::lStartRun := .T.
ENDIF
Return Nil
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.04
- cmsoft
- Posts: 1297
- Joined: Wed Nov 16, 2005 9:14 pm
- Location: Mercedes - Bs As. Argentina
- Been thanked: 2 times
Re: TWebView:Destroy method does not close the window.
Antonio, para probar, hay que descargar nuevamente las librerias?
Ya que pruebo el ejemplo de Hakan y me quedan abiertas ventanas...
Desde ya muchas gracias
Ya que pruebo el ejemplo de Hakan y me quedan abiertas ventanas...
Desde ya muchas gracias