Creates and returns a ShellWindows object. This object represents a collection of all of the open windows that belong to the Shell.
Syntax
oWindows = Shell.Windows()
Return Value
An object reference to the ShellWindows object.
Examples
The following example uses
Windows to retrieve the
ShellWindows object and display a count of the number of items that it contains. Proper usage is shown for Microsoft JScript, Microsoft Visual Basic Scripting Edition (VBScript), and Visual Basic.
JScript:
<script language="JScript">
function fnShellWindowsJ()
{
var objShell = new ActiveXObject("Shell.Application");
var objShellWindows;
objShellWindows = objShell.Windows();
if (objShellWindows != null)
{
alert(objShellWindows.Count);
}
}
</script>
VBScript:
<script language="VBScript">
function fnShellWindowsVB()
dim objShell
dim objShellWindows
set objShell = CreateObject("Shell.Application")
set objShellWindows = objShell.Windows
if (not objShellWindows is nothing) then
alert(objShellWindows.Count)
end if
set objShellWindows = nothing
set objShell = nothing
end function
</script>
Visual Basic:
Private Sub fnShellWindowsVB()
Dim objShell As Shell
Dim objShellWindows As ShellWindows
Set objShell = New Shell
Set objShellWindows = objShell.Windows
If (Not objShellWindows Is Nothing) Then
Debug.Print objShellWindows.Count
End If
Set objShellWindows = Nothing
Set objShell = Nothing
End Sub
Applies To