Re: VBScript/COM DCOM settings
- From: "Alex K. Angelopoulos" <aka(at)mvps.org>
- Date: Sun, 12 Apr 2009 09:59:18 -0400
I've got nothing useful on this, unfortunately. : / I do have some comments on tabbing, which don't tell us much useful either. Excuse the PowerShell in data gathering below; it made it much easier to quickly test some things...
"Csaba Gabor" <danswer@xxxxxxxxx> wrote in message news:ae245a9f-e36e-4a9f-98f0-cb3fe5525605@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
http://msdn.microsoft.com/en-us/library/aa768329(VS.85).aspx
It says that pDisp, the first argument to DocumentComplete
is either a frame or top level window (of typename
HTMLWindow2 - it doesn't say that part, but that's what it is).
Side topic from this page: What's the distinction between "top level" and "highest level"? This from the Remarks section puzzles me:
"In the loading process, the highest level frame, which is not necessarily the top-level frame, fires the final DocumentComplete event."
Comments on the tabbed browsing issue below:
In any case, this issue of IE as a tabbed browser is
interesting. I am particularly interested in the
COM/VBScript way of doing the following:
1) Given an IE object, how do you enumerate the
top level windows (ie. the tabs)?
Shell.Application works fine. There's apparently a "root" IE running, but even though it shows up on the process list, it will never return a window object when you enumerate windows using Shell.Application's Windows() method. Here's what you see if you check processes with a tabbed browser running and then switch tabs and check again; the identity of the tab seems to be swapped:
PS> gps iexplore | sort starttime | ft id,starttime,mainwindowhandle,mainwindowtitle -autosize
Id StartTime MainWindowHandle MainWindowTitle
-- --------- ---------------- ---------------
4024 2009-04-12 08:58:31 133484 DocumentComplete Event (InternetExplorer, WebBrowser) - Windows Internet Explorer
3096 2009-04-12 09:00:36 0
4560 2009-04-12 09:38:02 0
PS> gps iexplore | sort starttime | ft id,starttime,mainwindowhandle,mainwindowtitle -autosize
Id StartTime MainWindowHandle MainWindowTitle
-- --------- ---------------- ---------------
4024 2009-04-12 08:58:31 133484 Google Advanced Search - Windows Internet Explorer
3096 2009-04-12 09:00:36 0
4560 2009-04-12 09:38:02 0
2) How do I spawn a new tab in a given IE?
I have no idea whether it's possible or not, although it's almost certainly not controllable through standard COM automation, since that apparent root IE instance can't be accessed. If I have multiple IE tabs running and start a new IE instance from script, it shows up as a child of the same IE instance as the tabs - see this:
PS> $ie = new-object -comobject InternetExplorer.Application
PS> gwmi win32_process | ?{$_.name -eq "iexplore.exe"} | ft ProcessId,ParentProcessId -AutoSize
ProcessId ParentProcessId
--------- ---------------
4024 2816
3096 4024
4560 4024
4816 4024
However, if I make the window visible, it doesn't show up in the current tab set. This is probably tied in to security decisions.
3) How do I activate (bring to top) a given tab?
For example, imagine I had titles C, C#, D, D#, E, F...
and I wanted to play a little tune and activate the
corresponding tab in time to the music. Could I
do that?
The best tool for this job is always Sendkeys.
PS. In case it wasn't clear, the example under
question 3 was a joke.
In case it wasn't clear, so was the answer. :p
Unfortunately, I don't have a serious answer. It probably IS possible to do somehow via APIs or even .NET use, and it's quite possible that such a path will never be blocked since it doesn't have the same risks as direct COM exposure in this context - but even if that weren't a vague answer, it wouldn't help much with either WSH or PHP invocation.
.
- Follow-Ups:
- Re: VBScript/COM DCOM settings
- From: Csaba Gabor
- Re: VBScript/COM DCOM settings
- References:
- VBScript/COM DCOM settings
- From: Csaba Gabor
- Re: VBScript/COM DCOM settings
- From: Alex K. Angelopoulos
- Re: VBScript/COM DCOM settings
- From: mayayana
- Re: VBScript/COM DCOM settings
- From: Csaba Gabor
- VBScript/COM DCOM settings
- Prev by Date: Re: Weird problem with VBscript.
- Next by Date: Re: VBscript in 2008 Server Task Scheduler will not run
- Previous by thread: Re: VBScript/COM DCOM settings
- Next by thread: Re: VBScript/COM DCOM settings
- Index(es):
Relevant Pages
|