Bagikan melalui


Metode Shell.Windows

Membuat dan mengembalikan objek ShellWindows . Objek ini mewakili kumpulan semua jendela terbuka milik Shell.

Sintaks

retVal = Shell.Windows()

Shell.Windows() As IDispatch

Parameter

Metode ini tidak memiliki parameter.

Menampilkan nilai

JScript

Jenis: IDispatch**

Referensi objek ke objek ShellWindows .

VB

Jenis: IDispatch**

Referensi objek ke objek ShellWindows .

Contoh

Contoh berikut menggunakan Windows untuk mengambil objek ShellWindows dan menampilkan hitungan jumlah item yang dikandungnya. Penggunaan yang tepat ditampilkan untuk JScript, VBScript, dan 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

Persyaratan

Persyaratan Nilai
Klien minimum yang didukung
Windows 2000 Professional, Windows XP [hanya aplikasi desktop]
Server minimum yang didukung
Windows 2000 Server [hanya aplikasi desktop]
Header
Shldisp.h
IDL
Shldisp.idl
DLL
Shell32.dll (versi 4.71 atau yang lebih baru)