win32: internet explorer automation problem

M

mic

I'm currently trying to write an MSIE automation software and have run into
such problem - have no idea how to take control of external popup windows -
I use WebBrowser COM object and am able to catch the NewWindow2 event, but
don't know how to change 'focus' to other than main explorer window. I tried
to use winguiauto package and am able to get the HWND of the 'Internet
Explorer Server' control located in that new window, but I don't know
whether it is possible to force it to be my new COM object.

Regards,

Michal Zylinski
 
J

John J. Lee

mic said:
I'm currently trying to write an MSIE automation software and have run into
such problem - have no idea how to take control of external popup windows -
I use WebBrowser COM object and am able to catch the NewWindow2 event, but
don't know how to change 'focus' to other than main explorer window. I tried
[...]

I guess you just need to use the usual browser object model (the one
exposed to JavaScript &c.) -- eg. window.focus(), window.blur().
IIRC, it's IHTMLDocument2, or similar, that you want.


John
 
M

mic

I guess you just need to use the usual browser object model (the one
exposed to JavaScript &c.) -- eg. window.focus(), window.blur().
IIRC, it's IHTMLDocument2, or similar, that you want.

I don't think this could work - my piece of code is assumed to be completely
separated from the HTML itself. It just 'watches' the MSIE behaviour and
simulates the user work. AFAIK opening popup creates another MSIE instance,
so I simply loose the context. It'd be perfect if external window will be
treated using IHTMLDocument object model, but window object works according
to this excerpt from MSDN like this:

'Typically, the browser creates one window object when it opens an HTML
document. However, if a document defines one or more frames (that is,
contains one or more frame or iframe tags), the browser creates one window
object for the original document and one additional window object for each
frame'

So there is no easy way of doing it like
Document.NewWindow.documentelement.outerHTML. There is some ppDisp parameter
within OnNewWindow2 event, that looks like some sort of way to go...

Michal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top