Einzelnen Beitrag anzeigen

Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#3

Re: TWebbrowser verwendet IE7 obwohl ich IE8 habe.

  Alt 17. Dez 2009, 13:26
Delphi-Quellcode:
uses
 Registry;
 
type
  TIEMode = (iemIE7, iemIE8);
  // iemIE8: To run a WebBrowser control in IE8 Standards Mode
  // iemIE7: To run in IE7 Standards Mode
 
procedure SetWebbrowserMode(Mode: TIEMode; AppName: string = '');
const
  REG_KEY = 'Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION';
var
  Reg: TRegistry;
  Value: Integer;
begin
  if AppName = 'then
    AppName := ExtractFileName(Application.ExeName);
  Case Mode of
    iemIE7 : Value := $1B58;
    iemIE8 : Value := $1F40;
  end;
  Reg := TRegistry.Create();
  try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey(REG_KEY, True) then
    begin
      Reg.WriteInteger(AppName, Value);
      Reg.CloseKey;
    end;
  finally
    Reg.Free;
  end;
end;
 
procedure TForm1.Button1Click(Sender: TObject);
begin
  SetWebbrowserMode(iemIE8)
end;
Thomas
  Mit Zitat antworten Zitat