Danielmaximiliano wrote:Hola Leandro, gracias. Pero esa función solo detecta si webview.dll puede cargarse.
En el caso de webview2 no es necesaria.
Hola :
te suguiero leas https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution?tabs=win32cpp#detect-if-a-webview2-runtime-is-already-installed
Slds
Respecto a esta aproximación, en Windows 7 ( sí aún me quedan clientes usándolo ), da mejor resultado que la propuesta por Antonio, ya que aquella arroja un error de protección si el componente no está instalado.
Lo dicho, basándome en el enlace y siguiendo las instrucciones de Microsoft, se consulta el valor adecuado en diferentes puntos del registro.
Static Function IsWebView2Available()
// Comprueba en RegEdit si está instalado WebView2
// https://learn.microsoft.com/es-es/microsoft-edge/webview2/concepts/distribution?tabs=dotnetcsharp#detect-if-a-webview2-runtime-is-already-installed
#define HKEY_CURRENT_USER 2147483649 // 0x80000001
#define HKEY_LOCAL_MACHINE 2147483650 // 0x80000002
Local oReg AS Object := nil
Local cPv AS String := ''
oReg := TReg32():New( HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', .F. )
cPv := oReg:Get( 'pv' )
if Empty( cPv )
oReg := TReg32():New( HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', .f. )
cPv := oReg:Get( 'pv' )
endif
if Empty( cPv )
oReg := TReg32():New( HKEY_CURRENT_USER, 'Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', .f. )
cPv := oReg:Get( 'pv' )
endif
return ( .Not. Empty( cPv ) )