win32: anybody used IE's OnNewWindow2 event??
gcash at luncheonmeat.cfl.rr.com
Wed Jul 30 03:58:07 CEST 2003
OK, I've written a tool to do a bunch of Internet Explorer point&click
using win32all, and it's been rather fun.
I've run into a sticking point though... when I click some links, they
open up a new window where they expect you to fill out a form, and
when you submit it, it closes the window and forces the main screen to
a new URL.
Problem is, I can't find *ANY* way of getting control of that window,
in order to fill out the form automatically. There's no data
structure that seems to lead to other windows associated with a
Some of the small windows I've simply dissected the code and used
httplib to submit the form, then forced the URL navigation
myself. However, some of the windows are rather nasty pieces of
There's supposed to be an event called "OnNewWindow2" called when a
It has 2 parameters: an object and a cancel flag. These seem to be
"out" parameters, and I think you're supposed to whip up a new
InternetExplorer.Application.1 and pass it back in the object
parameter or set the cancel parameter to false. The new app object is
then used for the new window.
This event *does* get fired when it should, but both the arguments are
I can't figure out how to use this... can somebody help me out? I
tried googling about this and got almost no hits.
Does anyone have example code?
I've also looked at the genpy-generated code, looking for some sort of
handle on finding "child" subwindows (not frames, new top-level
instances) Is there some trick I'm missing?? Given a link "target"
name, can I find the instance of explorer (i.e. the "document" object)
that's servicing that window?
This is kicking my butt.
I've never tried emacs because I already _have_ an OS on this peecee.
-- mikea at mikea.ath.cx (Mike Andrews)
More information about the Python-list