ShellWindows.Item-Methode

Ruft ein InternetExplorer-Objekt ab, das das Shellfenster darstellt.

Syntax

retVal = ShellWindows.Item(
  [ iIndex ]
)

Parameter

iIndex [in, optional]

Typ: Variant

Der nullbasierte Index des abzurufenden Elements. Dieser Wert muss kleiner als der Wert der Count-Eigenschaft sein. Wenn dieser Wert weggelassen wird, wird der Standardwert 0 verwendet.

Rückgabewert

Typ: IDispatch**

Ein Objektverweis auf das InternetExplorer-Objekt , das das Shellfenster darstellt.

Beispiele

Im folgenden Beispiel wird Item verwendet, um das InternetExplorer-Objekt abzurufen, das das erste Shellfensterelement darstellt. Die ordnungsgemäße Verwendung wird für JScript, VBScript und Visual Basic angezeigt.

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

Anforderungen

Anforderung Wert
Unterstützte Mindestversion (Client)
Windows 2000 Professional, Windows XP [nur Desktop-Apps]
Unterstützte Mindestversion (Server)
Windows 2000 Server [nur Desktop-Apps]
Header
Exdisp.h
DLL
Shell32.dll (Version 4.71 oder höher)