Condividi tramite


Proprietà ShellWindows.Count

Contiene il numero di elementi nella raccolta.

Questa proprietà è di sola lettura.

Sintassi

iCount = ShellWindows.Count

Valore proprietà

Valore Integer contenente un valore per la proprietà Count.

Esempio

Nell'esempio seguente viene illustrato Count in use. L'utilizzo appropriato viene visualizzato per JScript, VBScript e 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

Requisiti

Requisito Valore
Client minimo supportato
Windows 2000 Professional, Windows XP [solo app desktop]
Server minimo supportato
Windows 2000 Server [solo app desktop]
Intestazione
Exdisp.h
DLL
Shell32.dll (versione 4.71 o successiva)