Partager via


ShellWindows.Count, propriété

Contient le nombre d’éléments dans la collection.

Cette propriété est en lecture seule.

Syntaxe

iCount = ShellWindows.Count

Valeur de la propriété

Entier qui contient une valeur pour la propriété Count.

Exemples

L’exemple suivant montre le nombre en cours d’utilisation. Une utilisation correcte est indiquée pour JScript, VBScript et Visual Basic.

Jscript:

<script language="JScript">
    function fnShellWindowsCountJ()
    {
        var objShell = new ActiveXObject("shell.application");
        var objShellWindows;
        
        objShellWindows = objshell.Shell_Windows();
        if (objShellWindows != null)
        {
            var nCount;
            
            nCount = objShellWindows.Count;
            alert(nCount);
        }
    }
</script>

Vbscript:

<script language="VBScript">
    function fnShellWindowsCountVB()
        dim objShell
        dim objShellWindows
        
        set objShell = CreateObject("shell.application")
        set objShellWindows = objshell.Shell_Windows

        if (not objShellWindows is nothing) then
            dim nCount
            nCount = objShellWindows.Count

            alert(nCount)
        end if

        set objShellWindows = nothing
        set objShell = nothing
    end function
 </script>

Visual Basic :

Private Sub fnShellWindowsCountVB()
    Dim objShell         As Shell
    Dim objShellWindows  As ShellWindows
    
    Set objShell = New Shell
    Set objShellWindows = objshell.Shell_Windows

    If (Not objShellWindows Is Nothing) Then
        Debug.Print objShellWindows.Count
    End If

    Set objShellWindows = Nothing
    Set objShell = Nothing
End Sub

Spécifications

Condition requise Valeur
Client minimal pris en charge
Windows 2000 Professionnel, Windows XP [applications de bureau uniquement]
Serveur minimal pris en charge
Windows 2000 Server [applications de bureau uniquement]
En-tête
Exdisp.h
DLL
Shell32.dll (version 4.71 ou ultérieure)