Sign in to follow this  
Followers 0

Blank white page rendered only in embedded IE control


27 posts in this topic

Posted (edited)

Hi,

when I render a web page embedded in a GUI and the height of the ActiveX control is greater than 8192 pixel then the web page will be shown only as an empty white page.

#include <windowsconstants.au3>

$hGUI = GUICreate("", 1024, 600)
GUISetState(@SW_SHOW, $hGUI)

$oIE = ObjCreate("Shell.Explorer.2")
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 1048, 8200)
Global Const $BrowserNavConstant = 2 + 128 + 256 + 512 + 4096 + 3276
$t = TimerInit()
With $oIE
	.Silent = True
	.FullScreen = True
	.Resizable = False
	.Visible = False
	.StatusBar = False
	.AddressBar = False
	.Navigate("www.stern.de", $BrowserNavConstant, "_top")
	Do
		Sleep(500)
		If .ReadyState = 4 Or TimerDiff($t) > 20000 Then ExitLoop
	Until False
	.Stop
EndWith

$oDocument = $oIE.document
$oBody = $oDocument.body
$oHtml = $oDocument.documentElement
$oBody.scroll = "no"
$oBody.style.borderStyle = "none"
$oBody.style.border = "0px"
$oHtml.style.overflow = 'hidden'


Do
Until GUIGetMsg() = -3

GUIDelete($hGUI)

Versions:

IE: 9.0.8112.1623

Autoit: 3.3.8.1 (running as x86)

Os: Win7 x64

No problems on Win8 (IE 10.0)

Can somebody confirm or even know why this happens?

Br,

UEZ

Edited by UEZ

Share this post


Link to post
Share on other sites



Posted

This is what I'm getting.

Posted Image

Win32 XP

Share this post


Link to post
Share on other sites

Posted

If you can see something then it is working.

But for me the GUI is only blank.

Thanks for testing!

Br,

UEZ

Share this post


Link to post
Share on other sites

Posted (edited)

No problem, it sucks though how operation on 32bit and 64bit is sometimes unpredictable.

Edited by ApudAngelorum

Share this post


Link to post
Share on other sites

Posted

It may be your rig

Share this post


Link to post
Share on other sites

Posted

After i tested i have same result like ApudAngelorum

win32 XPsp3

All though the first 2 times it was only a blank page and the script ended alone (and is not a connection issue)

Share this post


Link to post
Share on other sites

Posted (edited)

I tested it on Vista x64 in my VM with IE v9.0 and same problem there.

What IE versions you are using?

As far as I can remember with IE 8 it had worked but I may be wrong.

Br,

UEZ

Edited by UEZ

Share this post


Link to post
Share on other sites

Posted

UEZ i made a little search and found if it helps.

Share this post


Link to post
Share on other sites

Posted

I tested it on Vista x64 in my VM with IE v9.0 and same problem there.

What IE versions you are using?

Br,

UEZ

UEZ i have installed IE 9

But i dont use it

Share this post


Link to post
Share on other sites

Posted

UEZ i have installed IE 9

But i dont use it

I thought you said you were running XP? XP can't run IE9.

Share this post


Link to post
Share on other sites

Posted

No i dont use it

is IE9 preview

I have a set of Virtual Machines established which have an array of operating systems and browsers installed.

Also i have IETester with witch i can test IE10 preview, IE9, IE8, IE7 IE 6 and IE5.5 on Windows XP

Share this post


Link to post
Share on other sites

Posted (edited)

Have in mind that the web page will be rendered when the height of the activex control is less than 8192!

I've choosen stern.de because the height of the site is larger than 8192 pixels.

Br,

UEZ

Edited by UEZ

Share this post


Link to post
Share on other sites

Posted

Have in mind that the web page will be rendered when the height of the activex control is less than 8192!

I've choosen stern.de because the height of the site is larger than 8192 pixels.

Br,

UEZ

I didn't knew that..

Any workaround on your issue?

Share this post


Link to post
Share on other sites

Posted (edited)

I can see this issue in my Screenshooter tool and the workaround is to limit the height to 8192 pixels by accepting the cut off the web page at the buttom.

But do I have this problem only or is it a generell problem with IE9?

Br,

UEZ

Edited by UEZ

Share this post


Link to post
Share on other sites

Posted

I see the same under Win7 x64 and IE9, if that helps you any.

Share this post


Link to post
Share on other sites

Posted (edited)

It confirms my presumption that this is an issue with IE9. Now I need the reason why the page gets blank when it is higher than 8192 pixels.

Br,

UEZ

Edited by UEZ

Share this post


Link to post
Share on other sites

Posted

maybe if there was a method to set browser comparability mode for the operation.

Share this post


Link to post
Share on other sites

Posted

The odd thing is that when you browse the site in IE normally there is no problem with it - only when embedded and using the object commands.

Br,

UEZ

Share this post


Link to post
Share on other sites

Posted

I would recommend avoiding using the ObjCreateInterface with IE if you can. See my sig for alternatives what give the same visual effect, but use full browser instances.

Dale

Share this post


Link to post
Share on other sites

Posted (edited)

Thanks Dale, I will check your links in your signature whether I can adapt it into my tool.

Edit: I need to render the full web site without scroll bars to make a screenshot of it. The pseudo embedded solutions are unfortunately not usable for my purpose because of the scroll bars unless you can change that.

Br,

UEZ

Edited by UEZ

Share this post


Link to post
Share on other sites

Posted

Here:

$oIE.document.body.scroll = "no"
$oIE.document.body.style.overflow = "hidden"

Dale

Share this post


Link to post
Share on other sites

Posted

That's not working with this code:

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <IE.au3>

Dim $hGUI, $oIE, $sURL, $iLeft, $iTop, $iHeight, $iWidth, $i_PID

$sURL = "http://stern.de"
$iLeft = 0
$iTop = 0
$iWidth = 1024
$iHeight = 1600

$hGUI = GUICreate("Test", $iWidth, $iHeight)

$oIE = IECreatePseudoEmbedded($iLeft, $iTop, $iWidth, $iHeight, $hGUI)
_IENavigate($oIE, $sURL)
GUISetState(@SW_SHOW, $hGUI)

While GUIGetMsg() <> -3
WEnd

_IEQuit($oIE)
ProcessClose($i_PID)

While ProcessExists($i_PID)
WEnd

GUIDelete()
Exit


Func IECreatePseudoEmbedded($i_Left, $i_Top, $i_Width, $i_Height, $h_Parent, $f_ShowWin = False, $i_Timeout = 30000)

   Local Const $i_Random = Random(10001, 99999, 1)
   Local $oIE, $h_HWND, $h_Timer = TimerInit()

   $i_PID = Run(@ProgramFilesDir & "Internet Exploreriexplore.exe -k " & "about:blank-" & $i_Random, "", @SW_HIDE)

   $f_ErrorNotify = _IEErrorNotify()
   _IEErrorNotify(False)

   While Not IsObj($oIE)
	 $oIE = _IEAttach("about:blank-" & $i_Random, "URL")
     If TimerDiff($h_Timer) > $i_Timeout Then
        _IEErrorNotify($f_ErrorNotify)
        Return SetError(1, 0, 0)
     EndIf
     Sleep(200)
	WEnd

	$oIE.document.body.scroll = "no"
	$oIE.document.body.style.overflow = "hidden"

   _IEErrorNotify($f_ErrorNotify)

   $h_HWND = _IEPropertyGet($oIE, "hwnd")
   $h_HWND_h = _IEPropertyGet($oIE, "height")
   ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $h_HWND_h = ' & $h_HWND_h & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console


   _WinAPI_SetParent($h_HWND, $h_Parent)
   _WinAPI_MoveWindow($h_HWND, $i_Left, $i_Top, $i_Width, $i_Height, True)
   _WinAPI_SetWindowLong($h_HWND, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE)

   If $f_ShowWin Then
     WinSetState($h_HWND, "", @SW_SHOW)
   EndIf

   Return $oIE

EndFunc   ;==>IECreatePseudoEmbedded

The height of the IE window is fixed at 1050 pixels whereas the GUI is set to 1600.

Br,

UEZ

Share this post


Link to post
Share on other sites

Posted (edited)

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <IE.au3>

Dim $hGUI, $oIE, $sURL, $iLeft, $iTop, $iHeight, $iWidth, $i_PID

$sURL = "http://stern.de"
$iLeft = 0
$iTop = 0
$iWidth = 1024
$iHeight = 1600

$hGUI = GUICreate("Test", $iWidth, $iHeight)

$oIE = IECreatePseudoEmbedded($iLeft, $iTop, $iWidth, $iHeight, $hGUI)
ObjEvent($oIE, "_IEEvent_", "DWebBrowserEvents2")
_IENavigate($oIE, $sURL)

GUISetState(@SW_SHOW, $hGUI)

While GUIGetMsg() <> -3
WEnd

_IEQuit($oIE)
ProcessClose($i_PID)

While ProcessExists($i_PID)
WEnd

GUIDelete()
Exit

Func IECreatePseudoEmbedded($i_Left, $i_Top, $i_Width, $i_Height, $h_Parent, $f_ShowWin = False, $i_Timeout = 30000)
   Local Const $i_Random = Random(10001, 99999, 1)
   Local $oIE, $h_HWND, $h_Timer = TimerInit()
   $i_PID = Run(@ProgramFilesDir & "Internet Exploreriexplore.exe -k " & "about:blank-" & $i_Random, "", @SW_HIDE)
   $f_ErrorNotify = _IEErrorNotify()
   _IEErrorNotify(False)
   While Not IsObj($oIE)
	 $oIE = _IEAttach("about:blank-" & $i_Random, "URL")
	 If TimerDiff($h_Timer) > $i_Timeout Then
		_IEErrorNotify($f_ErrorNotify)
		Return SetError(1, 0, 0)
	 EndIf
	 Sleep(200)
	WEnd
   _IEErrorNotify($f_ErrorNotify)
   $h_HWND = _IEPropertyGet($oIE, "hwnd")
   $h_HWND_h = _IEPropertyGet($oIE, "height")
   ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $h_HWND_h = ' & $h_HWND_h & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
   _WinAPI_SetParent($h_HWND, $h_Parent)
   _WinAPI_MoveWindow($h_HWND, $i_Left, $i_Top, $i_Width, $i_Height, True)
   _WinAPI_SetWindowLong($h_HWND, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE)
   If $f_ShowWin Then
	 WinSetState($h_HWND, "", @SW_SHOW)
   EndIf
   Return $oIE
EndFunc   ;==>IECreatePseudoEmbedded

Func _IEEvent_NavigateComplete2($ptrBrowser, $ptrURL)
$oIE.document.body.scroll = "no"
$oIE.document.body.style.overflow = "hidden"
EndFunc   ;==>_IEEvent_NavigateComplete2

Edited by rover

Share this post


Link to post
Share on other sites

Posted

It is not clear to me what you are saying isn't working, but based on @rover's solution, the page loads have to be complete before the command I gave you will work.

@rover's code looks good -- this can also be done by calling _IELoadWait() prior to trying to remove the scrollbars.

Dale

Share this post


Link to post
Share on other sites

Posted (edited)

Ok, maybe I should give some more background infomation what I'm trying to do.

In the tool "Windows Screenshooter" you have the option to screenshot a web site that means the web site will be rendered embedded in a gui and the gui will be screenshot afterwards.

This works properly when Aero is enabled but an issue is when the ActiveX control size (height) is larger than 8192 pixel and IE9 is used, the rendered web site within the gui is just blank white. That's the reason why I opened this topic.

One workaround might the solution you provided in the code from post#22 but the web site will not be rendered using the full height instead there are scroll bars and the height is limited to 1050 pixels. I know that this example site has a large height size.

I know further that is much better but I started this way for now...

I hope this gives more information.

Br,

UEZ

Edited by UEZ

Share this post


Link to post
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
Sign in to follow this  
Followers 0