PDA

Ver la Versión Completa : Internet Explorer - Modo de explorador.


Jose_Pérez
20-09-2013, 09:31:18
Hola:

En Internet Explorer 9, es posible cambiar el modo de explorador a una versión anterior. Esto se consigue pulsando F12 y cambiando a la versión deseada en la barra de menús.

Pues bien, ¿es posible cambiar el modo de explorador a través de Delphi 5?

Un saludo.

Pericles
30-09-2013, 17:07:55
Hola, te paso información que figura en ayuda de windows.. y función ejemplo de llamadas desde delphi 2010... estimo que funcinoaria sin problemas en delphi 7.

Saludos
Nicolas Perichon

Elemento a modificar en Registro de windows:

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
SOFTWARE Microsoft Internet Explorer Main FeatureControl
FEATURE_BROWSER_EMULATION
contoso.exe = (DWORD) 000090000

info de Microsoft:
msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation


procedure SetRegistryData(RootKey: HKEY; Key, Value: string;
RegDataType: TRegDataType; Data: variant);
var
Rergistro: TRegistry;
texto: string;
begin
Rergistro := TRegistry.Create(KEY_WRITE);
try
Rergistro.RootKey := RootKey;
if Rergistro.OpenKey(Key, True) then
begin
try
//rdUnknown, rdString, rdExpandString, rdInteger, rdBinary
if RegDataType = rdUnknown then RegDataType := Rergistro.GetDataType(Value);
if RegDataType = rdString then
Rergistro.WriteString(Value, Data)
else if RegDataType = rdExpandString then
Rergistro.WriteExpandString(Value, Data)
else if RegDataType = rdInteger then
Rergistro.WriteInteger(Value, Data)
else if RegDataType = rdBinary then
begin
texto := Data;
Rergistro.WriteBinaryData(Value, PChar(texto)^, Length(texto));
end
else
raise Exception.Create(SysErrorMessage(ERROR_CANTWRITE));
except
Rergistro.CloseKey;
raise;
end;
Rergistro.CloseKey;
end
else
raise Exception.Create(SysErrorMessage(GetLastError));
finally
Rergistro.Free;
end;
end;



Ejemplo de codigo de llamada:


SetRegistryData(HKEY_LOCAL_MACHINE,
'\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION',
'contoso.exe',rdBinary, 9999 );

Jose_Pérez
02-10-2013, 22:05:30
Parece que funciona en Delphi 5, sin embargo, no consigo cambiar el modo del explorador a la versión 7. He pasado la versión deseada en el último parámetro, como se muestra abajo en el código. ¿Cuál es la forma correcta de hacerlo?


SetRegistryData(HKEY_LOCAL_MACHINE,
'\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION',
'contoso.exe',rdBinary, 7);


Gracias por tu respuesta.

Pericles
03-10-2013, 20:49:22
Hola, supuestamente según MS el código debería ser 7000 para IE7.

Saludos
Nicolas Perichon

info de Microsoft:
msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation

10001 (0x2711)Internet Explorer 10. Webpages are displayed in IE10 Standards mode, regardless of the !DOCTYPE directive.
10000 (0x02710) Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. Default value for Internet Explorer 10.
9999 (0x270F)Windows Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the !DOCTYPE directive.
9000 (0x2328)Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode. Default value for Internet Explorer 9.
Important In Internet Explorer 10, Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode.
8888 (0x22B8)Webpages are displayed in IE8 Standards mode, regardless of the !DOCTYPE directive.
8000 (0x1F40)Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode. Default value for Internet Explorer 8
Important In Internet Explorer 10, Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode.
7000 (0x1B58) Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode. Default value for applications hosting the WebBrowser Control.

Jose_Pérez
20-10-2013, 14:39:14
SetRegistryData(HKEY_LOCAL_MACHINE,
'\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION',
'contoso.exe',rdBinary, 7000);


No consigo que funcione.

Y disculpa la demora en contestarte.

dec
20-10-2013, 14:58:50
Hola,

Probablemente no te funciona porque tu aplicación no tiene permisos para escribir en "HKEY_LOCAL_MACHINE". Sin embargo, en realidad no es necesario, puesto que la misma clave se encuentra en "HKEY_CURRENT_USER". Así que cambia lo uno por lo otro y prueba a ver.

Jose_Pérez
20-10-2013, 19:20:00
No funciona de ninguna de las maneras. Lo estoy provando en Windows 7 Professional.