Re: Programmatic clicking and new windows

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Jan 15, 4:49 am, Csaba Gabor <dans...@xxxxxxxxx> wrote:
On Jan 11, 9:20 pm, mr_unreliable <kindlyReplyToNewsgr...@xxxxxxxxxxx>
wrote:

Csaba Gabor wrote:
Subject to the popup blocker, the code below will bring up
two instances of IE. The first one is identified by the
variable ie below. What is the cleanest way to get
ahold of the second one that gets created in the
last line (lnk.click)?

hi Csaba,

You might be able to use the "shell.application" to do
what you want. You can search through the window objects
and find the instances of IE, and then use the document
title to find the specific instance you want.

Here is a script that illustrates this (not exactly, but
close enough).

...
Example script
...

As you see, look through the windows for type "htmldocument".
Then look for the title. You also have access to the doc
object model for each IE window.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)

Hi jw,
Thanks for your thoughts, here's a follow up. I am
aware of your approach of iterating through
Set Wins = CreateObject("Shell.Application").Windows
In fact, Eduardo's code would be simplified, methinks,
(and doable in VBScript) if he just compared the hwnd
property of each window within Wins.
The trouble is that neither approach is iron clad.

I found an ancient thread which gave the recommended way athttp://groups.google.com/group/microsoft.public.vb.general.discussion...
in RND's last post: he used IE's NewWindow2 event (there
is also NewWindow3). Now this is sort of a funny sort of
creature - the event handler wants its first argument set
to a newly created IE to override the default IE that would
be created. Unfortunately, VBScript can't pass the
modified ByRef argument. So you can watch it, and know
it's about to happen, but you can't do anything about it.

However, PHP is able to work with this event handler
(sort of) and it works. Unfortunately, PHP has a bug
as far as I can tell in setting the (first arg's object) value.
Somewhere in the process they corrupt the variable (the
new IE object), but by then I've got its hwnd (ha ha),
so it is no longer able to hide from me. The problem is
that after running beautifully, this little copying maneuvre
prevents PHP from quitting gracefully - I get a nasty error
each time, presumably reference counts are messed up.
So all I hope is that a developer responds to the bug
report I made.

Regards,
Csaba

Just a quick followup. I have found a way to terminate
my php program without it complaining. I get its
process id ($pid=getmypid()) and then I forcefully
kill it on my Win XP system with:
exec ("taskkill /F /PID $pid"); or to write it as vbscript:
CreateObject("WScript.Shell").Exec("taskkill /F /PID " & pid)

I hope they fix the bug,
Csaba
.



Relevant Pages

  • Re: Programmatic clicking and new windows
    ... You can search through the window objects ... Now this is sort of a funny sort of ... PHP is able to work with this event handler ...
    (microsoft.public.scripting.vbscript)
  • Re: [Full-disclosure] Fwd: FreePBX Unfounded RCE PoC or rather Misguided PoC maybe ?
    ... OK well, after trying again with the php code, but corrected php code, i ... dont think it is possible to save a page.. ... I have written 3 or so PoC's for this and also for another bug in this, ... allowed to specify a path to upload a file to. ...
    (Full-Disclosure)
  • Re: php extensions compile error - another compile bug?
    ... Re: php extensions compile error - another compile bug?: ... Is not triviality is a matter of perspective? ... AFFECTS: users of PHP ... and shared extensions to allow more flexibility and add new features. ...
    (freebsd-questions)
  • Re: e-commerce portal
    ... haven't had a single site that sees a need for this sort of hardening. ... Java anymore. ... PHP is a technology that has gotten a harsh rap due to large security ... Marketing at its worse, eh? ...
    (comp.databases.pick)
  • Multibyte Wackiness on RHEL
    ... should upgrade to PHP 5.2. ... Test DateTimeZone::listIdentifiers function: basic functionality ... SPL: ... Bug #48770 fails to call parent from inheriting ...
    (comp.lang.php)