Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Opening an hidden Window with window.open (HTML)

Reply
 
Old 08-26-2009   #1 (permalink)
MassimoP


 
 

Opening an hidden Window with window.open (HTML)

Hi,

I'm trying to open a new hidden window from an HTML page.
I know that this is possible using the InternetExplorer.Application
object, but for other reasons I need to use the open method
of the current window. In this way I've a reference to the
creating window from the created window (window.opener).
The problem is that I cannot find a way to hide the created
window. Is there any way to achieve this ?
Alternatively, is there any way to get the InternetExplorer.Application
object associated with a window ? I tryed window.parent, but
seems to return the window itself.

Thanks.

Massimo.

--


My System SpecsSystem Spec
Old 08-26-2009   #2 (permalink)
mr_unreliable


 
 

Re: Opening an hidden Window with window.open (HTML)

MassimoP wrote:
Quote:

> I'm trying to open a new hidden window from an HTML page.
> I know that this is possible using the InternetExplorer.Application
> object, but for other reasons I need to use the open method
> of the current window. In this way I've a reference to the
> creating window from the created window (window.opener).
> The problem is that I cannot find a way to hide the created
> window. Is there any way to achieve this ?
> Alternatively, is there any way to get the InternetExplorer.Application
> object associated with a window ? I tryed window.parent, but
> seems to return the window itself.
>
hi Massimo,

You might try using the "Shell.Applicaton" object, which will
provide you with a collection of windows. The windows you get
are InternetExplorer windows _plus_ windows-explorer windows.

The way you tell them apart is via the type of the window.
document property, where "HTMLDocument" implies an IE window,
and "IShellFolderViewDual" implies a windows-explorer window.

There is an hta attached, which provides an example of this.

The properties of the window objects are "hidden" (at least
to me), and so I can't take you further. But you can probably
use the doc object of the IE windows to get the window's title
(caption), and maybe work with that (plus some other scripting
magic) to hide the window.

cheers, jw
____________________________________________________________

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

p.s., if you are not adverse to calling the system api's
from script, then you could use the hWnd and the ShowWindow
api with the SW_HIDE parameter to hide the window.

<HEAD>
<HTA:APPLICATION>
</HEAD>
<HTML>
<BODY>
<SCRIPT LANGUAGE="VBScript">
' enum shell windows (most likely IE and Explorer windows). jw 11June08
' report the hWnd of IE windows present...
set shell = CreateObject("shell.application")
for each oWin in shell.windows ' walk through the shell window collection
' determine whether window is IE or just explorer...
sWinType = TypeName(oWin.Document)
Select Case sWinType
Case "HTMLDocument"
document.write "<pre>"
document.write _
"Window Document Type: " & TypeName(oWin.Document) & "<br>" & _
"LocationURL: " & oWin.locationURL & "<br>" & _
" (note: this window appears to be an instance of InternetExplorer... <br>" & _
"Window hWnd: " & CStr(oWin.hWnd) & "<br>"
document.write "</pre>"
Case "IShellFolderViewDual"
document.write "<pre>"
document.write _
"Window Document Type: " & TypeName(oWin.Document) & "<br>" & _
"LocationURL: " & oWin.locationURL & "<br>" & _
" (note: this window appears to be an instance of windows explorer... <br>" & _
"Window hWnd: " & CStr(oWin.hWnd) & "<br>"
document.write "</pre>"
Case Else
document.write "<pre>"
document.write _
"Window Document Type: " & TypeName(oWin.Document) & "<br>" & _
"LocationURL: " & oWin.locationURL & "<br>" & _
" (note: this window is not a recognized type... <br>" & _
"Window hWnd: " & CStr(oWin.hWnd) & "<br>"
document.write "</pre>"
End Select
next
</SCRIPT>
</BODY>
</HTML>
My System SpecsSystem Spec
Old 08-27-2009   #3 (permalink)
MassimoP


 
 

Re: Opening an hidden Window with window.open (HTML)

mr_unreliable wrote:
Quote:

> MassimoP wrote:
Quote:

> > I'm trying to open a new hidden window from an HTML page.
> > I know that this is possible using the InternetExplorer.Application
> > object, but for other reasons I need to use the open method
> > of the current window. In this way I've a reference to the
> > creating window from the created window (window.opener).
> > The problem is that I cannot find a way to hide the created
> > window. Is there any way to achieve this ?
> > Alternatively, is there any way to get the
> > InternetExplorer.Application object associated with a window ? I
> > tryed window.parent, but seems to return the window itself.
> >
>
> hi Massimo,
>
> You might try using the "Shell.Applicaton" object, which will
> provide you with a collection of windows. The windows you get
> are InternetExplorer windows plus windows-explorer windows.
>
> The way you tell them apart is via the type of the window.
> document property, where "HTMLDocument" implies an IE window,
> and "IShellFolderViewDual" implies a windows-explorer window.
>
> There is an hta attached, which provides an example of this.
>
> The properties of the window objects are "hidden" (at least
> to me), and so I can't take you further. But you can probably
> use the doc object of the IE windows to get the window's title
> (caption), and maybe work with that (plus some other scripting
> magic) to hide the window.
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
> the answers will be applicable to the questions)
>
> p.s., if you are not adverse to calling the system api's
> from script, then you could use the hWnd and the ShowWindow
> api with the SW_HIDE parameter to hide the window.
Hi JW,

in this way I find the window object, but I already have it
in return from window.open call. The problem is that the
window object doesn't have a visible property. Only the
InternetExplorer.Application object has a visible property.
Moreover, even in case I can find some magic to hide the
window, in this phase is late, cause the window.open lasts
for about half a second waiting IE to load the page (even
about:blank), so, hiding after the window.open, means having
a flicker on the screen.
I realized that may be better not to hide the window, but open
a page with something like "Please Wait...", that doesn't
scare the user.

Thanks anyway for you reply.

Massimo.

--

My System SpecsSystem Spec
Old 08-27-2009   #4 (permalink)
mayayana


 
 

Re: Opening an hidden Window with window.open (HTML)

Maybe it would help if you explain what you're
trying to accomplish. You created 1 IE but you
can't use 2? You need to open a new window,
but you don't want it to show?




My System SpecsSystem Spec
Old 08-28-2009   #5 (permalink)
mr_unreliable


 
 

Re: Opening an hidden Window with window.open (HTML)

mayayana wrote:
Quote:

> You need to open a new window,
> but you don't want it to show?
>
Indeed. The whole purpose of an IE window is
to show stuff.

If one wants a "hidden window", then any hidden
window will do.

wsh+vbs has three hidden windows, the last time
I counted. Maybe one of those would do.

One other minor point. You don't have to have
a "visible" property to hide a window. All you
need is to move it "offscreen", by setting the
windows left and/or top property to some large
negative (or positive for that matter) value.
While offscreen, it may remain visible, but
nobody can see it.

"Back-in-the-old-days", one could use the "MoveTo"
method to move the IE window offscreen, but ms has
put a stop to that foolishness. After all, who
could ever want to move a window offscreen.
(It can still be done via the system api, though).

cheers, jw
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Windows Mail progress window details won't stay hidden Vista mail
Error message when clicking on links and extra pop up html window. Vista mail
How to show the hidden folder again in Window Mail Vista mail
New window opening Vista General
loading an html string into an IE window PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46