Método Shell.Windows

Cria e retorna um objeto ShellWindows . Esse objeto representa uma coleção de todas as janelas abertas que pertencem ao Shell.

Sintaxe

retVal = Shell.Windows()

Shell.Windows() As IDispatch

Parâmetros

Esse método não tem parâmetros.

Valor retornado

JScript

Tipo: IDispatch**

Uma referência de objeto ao objeto ShellWindows .

VB

Tipo: IDispatch**

Uma referência de objeto ao objeto ShellWindows .

Exemplos

O exemplo a seguir usa o Windows para recuperar o objeto ShellWindows e exibir uma contagem do número de itens que ele contém. O uso adequado é mostrado para JScript, VBScript e Visual Basic.

Jscript:

<script language="JScript">
    function fnShellWindowsJ()
    {
        var objShell = new ActiveXObject("shell.application");
        var objShellWindows;
        
        objShellWindows = objShell.Windows();

        if (objShellWindows != null)
        {
            var Shell = new ActiveXObject("WScript.Shell");
            Shell.Popup(objShellWindows.Count);
        }
    }
</script>

Vbscript:

<script language="VBScript">
    function fnShellWindowsVBS()
        dim objShell
        dim objShellWindows
        
        set objShell = CreateObject("shell.application")
        set objShellWindows = objShell.Windows

        if (not objShellWindows is nothing) then
            WScript.Echo 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

Requisitos

Requisito Valor
Cliente mínimo com suporte
Windows 2000 Professional, Windows XP [somente aplicativos da área de trabalho]
Servidor mínimo com suporte
Windows 2000 Server [somente aplicativos da área de trabalho]
Cabeçalho
Shldisp.h
IDL
Shldisp.idl
DLL
Shell32.dll (versão 4.71 ou posterior)