Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Wed, 20 Jul 2005 00:14:03 -0700,    group: microsoft.public.inetsdk.programming.scripting.vbscript        back       


How to determine type of Shell window?   
I'm trying to loop through the existing Shell windows in order to get an 
object reference to a particular browser window.  Unfortunately, the Shell 
Window collection includes IE windows, Windows Explorer Windows and perhaps 
some other variants.

What I am trying to find is a window object property I can test to see if 
the window is an IE window.  If it is then I'll check other properties for a 
match - like o_window.document.title.  If the window is NOT an IE window, 
then the document property doesn't exist and my application fails.  I've been 
using the .path property and find that it works most of the time (it points 
to program files\Internet Explorer\" when it is IE) but I have found that 
some Shell instances don't support that property either.

It sure seems there should be a simple test... any ideas?

Thanks,

Dale

Set o_Shell = CreateObject("Shell.Application")
Set o_ShellWindows = o_Shell.Windows ()
For each o_window In o_ShellWindows
       ' What property can I test to see if this is an IE Window?
Next
date: Wed, 20 Jul 2005 00:14:03 -0700   author:   DaleH

Re: How to determine type of Shell window?   
DaleH wrote:
> I'm trying to loop through the existing Shell windows in order to get
> an object reference to a particular browser window.  Unfortunately,
> the Shell Window collection includes IE windows, Windows Explorer
> Windows and perhaps some other variants.
>
> What I am trying to find is a window object property I can test to
> see if the window is an IE window.  If it is then I'll check other
> properties for a match - like o_window.document.title.  If the window
> is NOT an IE window, then the document property doesn't exist and my
> application fails.  I've been using the .path property and find that
> it works most of the time (it points to program files\Internet
> Explorer\" when it is IE) but I have found that some Shell instances
> don't support that property either.
>
> It sure seems there should be a simple test... any ideas?

Run this with both IE and Windows Explorer windows open...

Set o_Shell = CreateObject("Shell.Application")
Set o_ShellWindows = o_Shell.Windows ()
For each o_window In o_ShellWindows
       wscript.echo TypeName(o_window.document)
Next


-- 
Michael Harris
Microsoft MVP Scripting
date: Thu, 21 Jul 2005 17:19:52 -0700   author:   Michael Harris \(MVP\) mikhar at mvps dot org

Re: How to determine type of Shell window?   
Thanks Michael.  That works.  Unfortunately, where I'm actually trying to 
apply this is in a scripting language called AutoIt -- which support COM but 
does not (yet) have a TypeName function.The AutoIt devs are looking to supply 
a TypeName function, but in the mean time it seemed so logical that there 
would be a Shell property that held this information.

If you can think of any other tricks, I'd love to hear them.  Thanks very 
much for the reply.

Dale

"Michael Harris (MVP)" wrote:

> DaleH wrote:
> > I'm trying to loop through the existing Shell windows in order to get
> > an object reference to a particular browser window.  Unfortunately,
> > the Shell Window collection includes IE windows, Windows Explorer
> > Windows and perhaps some other variants.
> >
> > What I am trying to find is a window object property I can test to
> > see if the window is an IE window.  If it is then I'll check other
> > properties for a match - like o_window.document.title.  If the window
> > is NOT an IE window, then the document property doesn't exist and my
> > application fails.  I've been using the .path property and find that
> > it works most of the time (it points to program files\Internet
> > Explorer\" when it is IE) but I have found that some Shell instances
> > don't support that property either.
> >
> > It sure seems there should be a simple test... any ideas?
> 
> Run this with both IE and Windows Explorer windows open...
> 
> Set o_Shell = CreateObject("Shell.Application")
> Set o_ShellWindows = o_Shell.Windows ()
> For each o_window In o_ShellWindows
>        wscript.echo TypeName(o_window.document)
> Next
> 
> 
> -- 
> Michael Harris
> Microsoft MVP Scripting
date: Thu, 21 Jul 2005 20:17:02 -0700   author:   DaleH

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us