ShellWindows. Item, méthode

Récupère un objet InternetExplorer qui représente la fenêtre de l’interpréteur de commandes.

Syntaxe

retVal = ShellWindows.Item(
  [ iIndex ]
)

Paramètres

iIndex [ dans, facultatif]

Type : variante

Index de base zéro de l'élément à récupérer. Cette valeur doit être inférieure à la valeur de la propriété Count . Si cette valeur est omise, la valeur par défaut 0 est utilisée.

Valeur de retour

Type : IDispatch**

Référence d’objet à l’objet InternetExplorer qui représente la fenêtre de l’interpréteur de commandes.

Exemples

L’exemple suivant utilise Item pour récupérer l’objet InternetExplorer qui représente le premier élément de la fenêtre d’interpréteur de commandes. l’utilisation appropriée est indiquée pour JScript, VBScript et Visual Basic.

JScript :

<script language="JScript">
    function fnShellWindowsItemJ()
    {
        var objShell = new ActiveXObject("shell.application");
        var objShellWindows;
        
        objShellWindows = objshell.Windows();
        if (objShellWindows != null)
        {
            var objIE;
            objIE = objShellWindows.Item();

            if (objIE != null)
            {
                alert(objIE.path());
            }
        }
    }
</script>

VBScript

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

        if (not objShellWindows is nothing) then
            dim objIE
            set objIE = objShellWindows.Item

            if (not objIE is nothing) then
                Wscript.Echo objIE.path
            end if

            set objIE = nothing
        end if

        set objShellWindows = nothing
        set objShell = nothing
    end function
 </script>

Visual Basic :

Private Sub fnShellWindowsItemVB()
    Dim objShell        As Shell
    Dim objShellWindows As ShellWindows
    
    Set objShell = New Shell
    Set objShellWindows = objshell.Windows()

    If (Not objShellWindows Is Nothing) Then
        Dim objIE As InternetExplorer
        Set objIE = objShellWindows.Item

        If (Not objIE Is Nothing) Then
            Debug.Print objIE.Path
        End If

        Set objIE = Nothing
    End If

    Set objShellWindows = Nothing
    Set objShell = Nothing
End Sub

Spécifications

Condition requise Valeur
Client minimal pris en charge
Windows 2000 Professional, Windows XP [ desktop apps uniquement]
Serveur minimal pris en charge
Windows 2000 Server - [Applications de bureau uniquement]
En-tête
Exdisp. h
DLL
Shell32.dll (version 4,71 ou ultérieure)