Jump to content

[Solved] Different look: IE11 vs. ObjCreate("Shell.Explorer.2")


Recommended Posts

Hi.

I'm trying to do a teletext viewer. Here is my code:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>

Local $sURL = "http://www.ndr.de/public/teletext/100_01.htm"
Local $oIE = ObjCreate("Shell.Explorer.2")
GUICreate("NDR Text", 494, 601)
GUICtrlCreateObj($oIE, 0, 0, 513, 574)
Local $idLabel_Number = GUICtrlCreateInput("", 2, 574, 60, 25, $ES_CENTER)
GUICtrlSetFont(-1, 14)
GUICtrlSetLimit(-1, 3)
GUICtrlSetState(-1, $GUI_FOCUS)
Local $idButton_OK = GUICtrlCreateButton("OK", 64, 574, 60, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetFont(-1, 14)
$oIE.navigate($sURL)
GUISetState(@SW_SHOW) ;Show GUI

While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $idButton_OK
            If GUICtrlRead($idLabel_Number) >= 100 And GUICtrlRead($idLabel_Number) < 900 Then
                $oIE.navigate("http://www.ndr.de/public/teletext/" & GUICtrlRead($idLabel_Number) & "_01.htm")
            EndIf
            GUICtrlSetState($idLabel_Number, $GUI_FOCUS)
    EndSwitch
WEnd
GUIDelete()

It works but it doesn't look so good as shown direct in the InternetExplorer 11. Differences seen in the images I attached. I want to have the look like in the IE (first picture).

How to change my code?

Regards, Conrad

 

Teletext_NDR_IE.PNG

Teletext_NDR_AutoIt.PNG

Edited by Simpel
[Solved]
SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Hi @Simpel.

"Shell.Explorer.2" creates a IE 7.0 embedded browser by default. That might be the reason for the differences. See below:

#include <IE.au3>
Local $oIE = ObjCreate("Shell.Explorer.2")
GUICreate("", 700, 320)
GUICtrlCreateObj($oIE, 0, 0, 513, 574)
_IENavigate($oIE, "about:blank")
$userAgent = $oIE.Document.parentWindow.navigator.userAgent
MsgBox(0, "IE ver", StringRegExp($userAgent, "MSIE ([0-9]+.[0-9]+)", 1)[0])

Here is a link that might help you change that: Controlling WebBrowser Control Compatibility

Hope this helps you out :)

Link to comment
Share on other sites

Hi.

@genius257 you link me in the right direction. Because I have no access to the web page I use the case with registry edit:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <TrayCox.au3>

Local $sURL = "http://www.ndr.de/public/teletext/100_01.htm"
Local $oIE = ObjCreate("Shell.Explorer.2")
If @Compiled Then
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", @ScriptName, "REG_DWORD", 11001)
Else
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", "AutoIt3.exe", "REG_DWORD", 11001)
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", "autoit3_x64.exe", "REG_DWORD", 11001)
EndIf
Local $iOffsetLaengeKompatibilitaet = 20
GUICreate("NDR Text", 492, 621)
GUICtrlCreateObj($oIE, 0, 0, 513, 594)
Local $idLabel_Number = GUICtrlCreateInput("", 2, 594, 60, 25, $ES_CENTER)
GUICtrlSetFont(-1, 14)
GUICtrlSetLimit(-1, 3)
GUICtrlSetState(-1, $GUI_FOCUS)
Local $idButton_OK = GUICtrlCreateButton("OK", 64, 594, 60, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetFont(-1, 14)
$oIE.navigate($sURL)
Sleep(500)
GUISetState(@SW_SHOW) ;Show GUI

While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $idButton_OK
            If GUICtrlRead($idLabel_Number) >= 100 And GUICtrlRead($idLabel_Number) < 900 Then
                $oIE.navigate("http://www.ndr.de/public/teletext/" & GUICtrlRead($idLabel_Number) & "_01.htm")
            EndIf
            GUICtrlSetState($idLabel_Number, $GUI_FOCUS)
    EndSwitch
WEnd
If Not @Compiled Then
    RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", "AutoIt3.exe")
    RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", "autoit3_x64.exe")
EndIf
GUIDelete()

If Not @compiled I delete the registry keys after exit the program.

Thanks and regards, Conrad

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...