Compartilhar via


Método IShellDispatch.Windows

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

Sintaxe

retVal = IShellDispatch.Windows()

IShellDispatch.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 .

Comentários

Esse método é implementado e acessado por meio do método Shell.Windows .

Exemplos

Os exemplos a seguir usam o Windows para recuperar o objeto ShellWindows e exibir uma contagem do número de itens que ele contém. O uso é 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)
        {
            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

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)