Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

window.open resizes webbrowser control! / Bug in IE6 ?

6 views
Skip to first unread message

Simon Bühler

unread,
Dec 17, 2001, 9:31:06 PM12/17/01
to
hi

i am hosting a webbrowser control in an vb app. if a page contains
javascript window.open position my webbrowser control resizes and moves.
How can i avoid this behaviour? IE6 Events like setwindowleft etc just
don't fire!

i already tried
- subclass the "Internet Explorer_Server" to get WM_poschanging
messages but none ever appeared
- setwindowleft etc events (webbrowser1.move 1,1 -> no effect)
- DOM : in NavigateComplete2() hook the
webbrowser.document.parentWindow.onresize event -> no effect


having no clue
simon

Igor Tandetnik

unread,
Dec 18, 2001, 10:42:29 AM12/18/01
to
I think accidentally your control has a name that is mentioned in
window.open as a target, so your control becomes target of a navigation.
Or IE is set to reuse browser windows, and your control just happens to
be the one chosen for reuse.

To avoid any such problems, set RegisterAsBrowser property to false.
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Simon Bühler" <si...@aktionspotenzial.de> wrote in message
news:3C1EAA6A...@aktionspotenzial.de...

Simon Bühler

unread,
Dec 18, 2001, 12:50:03 PM12/18/01
to
thanks for your reply Igor,

the target for the new popup is on form2.webbrowser1, and i want to show
form2 with custom titlebar / no navbar / no rightclick etc. and no standard
webbrowser window.

my code is on form 1:

Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim popF As Form2 'contains a webbrowser control
Set popF = New Form2

popF.WebBrowser1.RegisterAsBrowser = True
Set ppDisp = popF.WebBrowser1.Object
popF.Visible = True
end sub

so on form2 i have

Private Sub WebBrowser1_WindowSetLeft(ByVal left As Long)
WebBrowser1.Move 1, 1
End Sub

which never fires when the popup contains someting like
<BODY onLoad="if (window.screen) { window.moveTo(5,
screen.availHeight/4);} ">

(check http://www.techno.de for this popup )

so when the window.moveTo method is called i need to get any event to deal
with.

greetz
simon

Igor Tandetnik

unread,
Dec 18, 2001, 1:33:37 PM12/18/01
to
I found only one way to handle moveTo, resizeTo and such. I subclass
browser window as obtained with IOleWindow::GetWindow call, and
intercept WM_WINDOWPOSCHANGING window message. The handler cancels
repositioning of the control, and instead uses the supplied coordinates
to reposition parent window (the form in VB parlance).

Unfortunately, I have not found a way to handle both moveTo and moveBy.
moveTo causes WM_WINDOWPOSCHANGING to be sent with new position
expressed in screen coordinates, and moveBy in client coordinates, and
no indication as to the cause of the move. So I assume that the
coordinates are screen, and document that moveBy behaves erratically and
is not supported.

Before you ask, I have no idea how to subclass a window in VB. I'm a C++
programmer.


--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Simon Bühler" <si...@aktionspotenzial.de> wrote in message

news:3C1F81CB...@aktionspotenzial.de...

0 new messages