Page 1 of 5

HMG with Edge WebView2

Posted: Tue Aug 17, 2021 2:22 am
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!

Re: HMG with Edge WebView2

Posted: Tue Aug 17, 2021 2:54 am
by AUGE_OHR
hi,

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

Re: HMG with Edge WebView2

Posted: Tue Aug 17, 2021 3:10 am
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 5180 times

Re: HMG with Edge WebView2

Posted: Tue Aug 17, 2021 4:05 am
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 );

Re: HMG with Edge WebView2

Posted: Tue Aug 17, 2021 5:11 am
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 5161 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 5161 times

Re: HMG with Edge WebView2

Posted: Tue Aug 17, 2021 5:59 pm
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.

Re: HMG with Edge WebView2

Posted: Tue Aug 17, 2021 8:53 pm
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 5064 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 5064 times
imagen_2021-08-17_155139.png
imagen_2021-08-17_155139.png (143.53 KiB) Viewed 5064 times

Re: HMG with Edge WebView2

Posted: Tue Aug 17, 2021 10:42 pm
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

Re: HMG with Edge WebView2

Posted: Tue Aug 17, 2021 11:42 pm
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 5047 times

Re: HMG with Edge WebView2

Posted: Wed Aug 18, 2021 12:17 am
by srvet_claudio
Hi,
this is a slightly improved version with more information to detect and solve errors in webview2 runtime.