Skip to content

Latest commit

 

History

History
133 lines (85 loc) · 2.68 KB

shellwindows-count.md

File metadata and controls

133 lines (85 loc) · 2.68 KB
description ms.assetid title ms.topic ms.date topic_type api_name api_type api_location
ShellWindows.Count property - Contains the number of items in the collection.
0113cc32-2197-4004-99a1-89fe10828e5f
ShellWindows.Count property (Exdisp.h)
reference
05/31/2018
APIRef
kbSyntax
ShellWindows.Count
COM
Shell32.dll

ShellWindows.Count property

Contains the number of items in the collection.

This property is read-only.

Syntax

iCount = ShellWindows.Count

Property value

An Integer that contains a value for the Count property.

Examples

The following example shows Count in use. Proper usage is shown for JScript, VBScript, and 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

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Exdisp.h
DLL
Shell32.dll (version 4.71 or later)