Méthode IShellDispatch.Windows

Crée et retourne un objet ShellWindows . Cet objet représente une collection de toutes les fenêtres ouvertes qui appartiennent à l’interpréteur de commandes.

Syntaxe

retVal = IShellDispatch.Windows()

IShellDispatch.Windows() As IDispatch

Paramètres

Cette méthode n’a aucun paramètre.

Valeur retournée

JScript

Type : IDispatch**

Référence d’objet à l’objet ShellWindows .

VB

Type : IDispatch**

Référence d’objet à l’objet ShellWindows .

Notes

Cette méthode est implémentée et accessible via la méthode Shell.Windows .

Exemples

Les exemples suivants utilisent Windows pour récupérer l’objet ShellWindows et afficher le nombre d’éléments qu’il contient. L’utilisation s’affiche pour JScript, VBScript et Visual Basic.

Jscript:

<script language="JScript">
    function fnShellWindowsJ()
    {
        var objShell = new ActiveXObject("shell.application");
        var objShellWindows;
        
        objShellWindows = objshell.Windows();

        if (objShellWindows != null)
        {
            alert(objShellWindows.Count);
        }
    }
</script>

Vbscript:

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

        if (not objShellWindows is nothing) then
            alert(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

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
Shldisp.h
IDL
Shldisp.idl
DLL
Shell32.dll (version 4.71 ou ultérieure)