Ver Mensaje Individual
  #5  
Antiguo 28-11-2021
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.107
Reputación: 34
dec Tiene un aura espectaculardec Tiene un aura espectacular
Hola a todos,

Dejo aquí una unidad que, con sólo añadirla al proyecto, añade lo necesario para "emular" Internet Explorer 11 en el componente WebBrowser: de este modo, al menos podría usarse esta última versión del explorador, que, ofrece ciertas mejoras, aunque, como he comentado arriba, hoy día, lo mejor sería plantearse utilizar el "WebView2" de Microsoft:

Código Delphi [-]

unit UBrowserFixes;

interface

type
  TBrowserFixes = class(TObject)
  public
    class procedure Initialize();
    class procedure Uninitialize();
  end;

implementation

uses
  // Delphi
  Windows,
  SysUtils,
  Registry;

const
  FEATURE_GPU_RENDERING_KEY = 'Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING';
  FEATURE_BROWSER_EMULATION_KEY = 'Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION';

{ TBrowserFixes }

class procedure TBrowserFixes.Initialize();
var
  ExeName: string;
begin
  ExeName := ExtractFileName(ParamStr(0));
  with TRegistry.Create() do
  try
    RootKey := HKEY_CURRENT_USER;

    if OpenKey(FEATURE_BROWSER_EMULATION_KEY, True) then
    begin
      if not ValueExists(ExeName) then
      begin
        // http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
        WriteInteger(ExeName, 11001);
      end;
      CloseKey();
    end;

    if OpenKey(FEATURE_GPU_RENDERING_KEY, True) then
    begin
      if not ValueExists(ExeName) then
      begin
        // https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx
        WriteInteger(ExeName, DWORD(1));
      end;
      CloseKey();
    end;

  finally
    Free();
  end;
end;

class procedure TBrowserFixes.Uninitialize();
var
  ExeName: string;
begin
  ExeName := ExtractFileName(ParamStr(0));

  with TRegistry.Create() do
  try
    RootKey := HKEY_CURRENT_USER;

    if OpenKey(FEATURE_BROWSER_EMULATION_KEY, False) then
    begin
      if ValueExists(ExeName) then
        DeleteValue(ExeName);
      CloseKey();
    end;

    if OpenKey(FEATURE_GPU_RENDERING_KEY, False) then
    begin
      if ValueExists(ExeName) then
        DeleteValue(ExeName);
      CloseKey();
    end;

  finally
    Free();
  end;
end;

initialization
  TBrowserFixes.Initialize();

finalization
  TBrowserFixes.Uninitialize();

end.
__________________
David Esperalta
www.decsoftutils.com
Responder Con Cita