HMG with Edge WebView2

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

HMG with Edge WebView2

Post by srvet_claudio »

Hi,
After much trial and error, and fight a little with the parameters of hbmk2 I managed to create a demo of HMG with Edge WebView2.
It is not much information on Edge WebView2 compiled with GCC/MinGW on the Internet maybe because most people use Visual Studio to build WebView2 applications. Most of the samples use MSVC ++ and a few of Microsoft's own compiler C++ classes.
I hope you enjoy!
Attachments
hmg_webview2.zip
(2.07 MiB) Downloaded 255 times
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
AUGE_OHR
Posts: 2064
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG with Edge WebView2

Post by AUGE_OHR »

hi,

try to run Sample and got Error
test_webview2.jpg
test_webview2.jpg (17.02 KiB) Viewed 4510 times
Windows Version 10.0.19044.1165
Microsoft Edge Version 92.0.902.73 (Offizielles Build) (32-Bit)
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: HMG with Edge WebView2

Post by andyglezl »

AUGE_OHR wrote: Tue Aug 17, 2021 2:54 am hi,

try to run Sample and got Error
test_webview2.jpg
Windows Version 10.0.19044.1165
Microsoft Edge Version 92.0.902.73 (Offizielles Build) (32-Bit)


Hola Dr. Soto, Saludos...
Igual conmigo !

Windows 10 Pro 21H1 19043.1165
Microsoft Edge Versión 92.0.902.73 (Compilación oficial) (64 bits)


Al compilarlo, despliega esto:

G:\AGL\Desarrollos\Pruebas\hmg_webview2>call build_cpp.bat test_webview2.prg -L./WebView2/Win32 -lWebView2Loader -I./WebView2/include
Harbour 3.2.0dev (r2011030937)
Copyright (c) 1999-2020, https://harbour.github.io/
In file included from test_webview2.prg:51:
G:/AGL/Desarrollos/Pruebas/hmg_webview2/WebView2/include/WebView2.h:19: warning: ignoring #pragma warning [-Wunknown-pragmas]
19 | #pragma warning( disable: 4049 ) /* more than 64k source lines */
|
test_webview2.prg: In instantiation of 'HRESULT Null_QueryInterface(T*, const IID&, void**) [with T = ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler; HRESULT = long int; IID = _GUID]':
test_webview2.prg:107:1: required from here
test_webview2.prg:82:57: warning: unused parameter 'This' [-Wunused-parameter]
test_webview2.prg:82:70: warning: unused parameter 'riid' [-Wunused-parameter]
test_webview2.prg:82:83: warning: unused parameter 'ppvObject' [-Wunused-parameter]
test_webview2.prg: In instantiation of 'ULONG Null_AddRef(T*) [with T = ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler; ULONG = long unsigned int]':
test_webview2.prg:107:1: required from here
test_webview2.prg:87:47: warning: unused parameter 'This' [-Wunused-parameter]
test_webview2.prg: In instantiation of 'ULONG Null_Release(T*) [with T = ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler; ULONG = long unsigned int]':
test_webview2.prg:107:1: required from here
test_webview2.prg:92:48: warning: unused parameter 'This' [-Wunused-parameter]
test_webview2.prg: In instantiation of 'HRESULT Null_QueryInterface(T*, const IID&, void**) [with T = ICoreWebView2CreateCoreWebView2ControllerCompletedHandler; HRESULT = long int; IID = _GUID]':
test_webview2.prg:120:1: required from here
test_webview2.prg:82:57: warning: unused parameter 'This' [-Wunused-parameter]
test_webview2.prg:82:70: warning: unused parameter 'riid' [-Wunused-parameter]
test_webview2.prg:82:83: warning: unused parameter 'ppvObject' [-Wunused-parameter]
test_webview2.prg: In instantiation of 'ULONG Null_AddRef(T*) [with T = ICoreWebView2CreateCoreWebView2ControllerCompletedHandler; ULONG = long unsigned int]':
test_webview2.prg:120:1: required from here
test_webview2.prg:87:47: warning: unused parameter 'This' [-Wunused-parameter]
test_webview2.prg: In instantiation of 'ULONG Null_Release(T*) [with T = ICoreWebView2CreateCoreWebView2ControllerCompletedHandler; ULONG = long unsigned int]':
test_webview2.prg:120:1: required from here
test_webview2.prg:92:48: warning: unused parameter 'This' [-Wunused-parameter]
g:/agl/hmg/3.5/mingw/bin/../lib/gcc/i686-w64-mingw32/9.3.0/../../../../i686-w64-mingw32/bin/ld.exe: warning: resolving _CreateCoreWebView2EnvironmentWithOptions@16 by linking to _CreateCoreWebView2EnvironmentWithOptions
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
imagen_2021-08-16_222014.png
imagen_2021-08-16_222014.png (5.26 KiB) Viewed 4505 times
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG with Edge WebView2

Post by srvet_claudio »

Hi,
1) My .exe not work?

2) Try change this line in C code:

HRESULT result = CreateCoreWebView2EnvironmentWithOptions( nullptr, TStrToWStr(szDataPath).c_str(), nullptr, &handler );

For this line:

HRESULT result = CreateCoreWebView2EnvironmentWithOptions( nullptr, nullptr, nullptr, &handler );
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: HMG with Edge WebView2

Post by andyglezl »

srvet_claudio wrote: Tue Aug 17, 2021 4:05 am Hi,
1) My .exe not work?
Así como viene el .exe que envió despliega lo siguiente.
imagen_2021-08-17_000551.png
imagen_2021-08-17_000551.png (5.26 KiB) Viewed 4486 times
2) Try change this line in C code:

HRESULT result = CreateCoreWebView2EnvironmentWithOptions( nullptr, TStrToWStr(szDataPath).c_str(), nullptr, &handler );

For this line:

HRESULT result = CreateCoreWebView2EnvironmentWithOptions( nullptr, nullptr, nullptr, &handler );

Resulta el mismo mensaje al volverlo a compilar ya modificado...
imagen_2021-08-17_000149.png
imagen_2021-08-17_000149.png (34.11 KiB) Viewed 4486 times
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG with Edge WebView2

Post by srvet_claudio »

There is not much information on webview2 with c ++ and the error answers are very ambiguous in many cases. Please compile this new file to see if we can better capture the error that occurred.
Attachments
new prg test_webview2.zip
(3 KiB) Downloaded 172 times
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: HMG with Edge WebView2

Post by andyglezl »

srvet_claudio wrote: Tue Aug 17, 2021 5:59 pm There is not much information on webview2 with c ++ and the error answers are very ambiguous in many cases. Please compile this new file to see if we can better capture the error that occurred.

Aquí va Dr. Soto...
..
imagen_2021-08-17_153450.png
imagen_2021-08-17_153450.png (4.3 KiB) Viewed 4389 times

Code: Select all

G:\AGL\Desarrollos\Pruebas\hmg_webview2>call build_cpp.bat  test_webview2.prg -L./WebView2/Win32 -lWebView2Loader -I./WebView2/include
Harbour 3.2.0dev (r2011030937)
Copyright (c) 1999-2020, https://harbour.github.io/
In file included from test_webview2.prg:54:
G:/AGL/Desarrollos/Pruebas/hmg_webview2/WebView2/include/WebView2.h:19: warning: ignoring #pragma warning  [-Wunknown-pragmas]
   19 | #pragma warning( disable: 4049 )  /* more than 64k source lines */
      |
test_webview2.prg: In instantiation of 'HRESULT Null_QueryInterface(T*, const IID&, void**) [with T = ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler; HRESULT = long int; IID = _GUID]':
test_webview2.prg:110:1:   required from here
test_webview2.prg:85:57: warning: unused parameter 'This' [-Wunused-parameter]
test_webview2.prg:85:70: warning: unused parameter 'riid' [-Wunused-parameter]
test_webview2.prg:85:83: warning: unused parameter 'ppvObject' [-Wunused-parameter]
test_webview2.prg: In instantiation of 'ULONG Null_AddRef(T*) [with T = ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler; ULONG = long unsigned int]':
test_webview2.prg:110:1:   required from here
test_webview2.prg:90:47: warning: unused parameter 'This' [-Wunused-parameter]
test_webview2.prg: In instantiation of 'ULONG Null_Release(T*) [with T = ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler; ULONG = long unsigned int]':
test_webview2.prg:110:1:   required from here
test_webview2.prg:95:48: warning: unused parameter 'This' [-Wunused-parameter]
test_webview2.prg: In instantiation of 'HRESULT Null_QueryInterface(T*, const IID&, void**) [with T = ICoreWebView2CreateCoreWebView2ControllerCompletedHandler; HRESULT = long int; IID = _GUID]':
test_webview2.prg:123:1:   required from here
test_webview2.prg:85:57: warning: unused parameter 'This' [-Wunused-parameter]
test_webview2.prg:85:70: warning: unused parameter 'riid' [-Wunused-parameter]
test_webview2.prg:85:83: warning: unused parameter 'ppvObject' [-Wunused-parameter]
test_webview2.prg: In instantiation of 'ULONG Null_AddRef(T*) [with T = ICoreWebView2CreateCoreWebView2ControllerCompletedHandler; ULONG = long unsigned int]':
test_webview2.prg:123:1:   required from here
test_webview2.prg:90:47: warning: unused parameter 'This' [-Wunused-parameter]
test_webview2.prg: In instantiation of 'ULONG Null_Release(T*) [with T = ICoreWebView2CreateCoreWebView2ControllerCompletedHandler; ULONG = long unsigned int]':
test_webview2.prg:123:1:   required from here
test_webview2.prg:95:48: warning: unused parameter 'This' [-Wunused-parameter]
g:/agl/hmg/3.5/mingw/bin/../lib/gcc/i686-w64-mingw32/9.3.0/../../../../i686-w64-mingw32/bin/ld.exe: warning: resolving _CreateCoreWebView2EnvironmentWithOptions@16 by linking to _CreateCoreWebView2EnvironmentWithOptions
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
.
imagen_2021-08-17_154618.png
imagen_2021-08-17_154618.png (178.05 KiB) Viewed 4389 times
imagen_2021-08-17_155139.png
imagen_2021-08-17_155139.png (143.53 KiB) Viewed 4389 times
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG with Edge WebView2

Post by srvet_claudio »

Hi Andres,
The information on the internet is scarce, but the problem seems to be with the runtime version you have of webview2, please update your runtime version from this Microsoft link:

https://go.microsoft.com/fwlink/p/?LinkId=2124703
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: HMG with Edge WebView2

Post by andyglezl »

srvet_claudio wrote: Tue Aug 17, 2021 10:42 pm Hi Andres,
The information on the internet is scarce, but the problem seems to be with the runtime version you have of webview2, please update your runtime version from this Microsoft link:

https://go.microsoft.com/fwlink/p/?LinkId=2124703

Solucionado Dr. Soto, muchas gracias por su ejemplo y ayuda !
imagen_2021-08-17_183955.png
imagen_2021-08-17_183955.png (1.49 MiB) Viewed 4372 times
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG with Edge WebView2

Post by srvet_claudio »

Hi,
this is a slightly improved version with more information to detect and solve errors in webview2 runtime.
Attachments
hmg_webview2_version02.zip
(2.08 MiB) Downloaded 274 times
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply