Shell.Windows メソッド

ShellWindows オブジェクトを作成して返します。 このオブジェクトは、シェルに属するすべての開いているウィンドウのコレクションを表します。

構文

retVal = Shell.Windows()

Shell.Windows() As IDispatch

パラメーター

このメソッドにはパラメーターはありません。

戻り値

JScript

種類: IDispatch**

ShellWindows オブジェクトへのオブジェクト参照。

VB

種類: IDispatch**

ShellWindows オブジェクトへのオブジェクト参照。

次の例では 、Windows を使用して ShellWindows オブジェクトを取得し、そのオブジェクトに含まれる項目の数を表示します。 JScript、VBScript、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

要件

要件
サポートされている最小のクライアント
Windows 2000 Professional、Windows XP [デスクトップ アプリのみ]
サポートされている最小のサーバー
Windows 2000 Server [デスクトップ アプリのみ]
ヘッダー
Shldisp.h
IDL
Shldisp.idl
[DLL]
Shell32.dll (バージョン 4.71 以降)