ShellWindows.Item メソッド

シェル ウィンドウを表す InternetExplorer オブジェクトを取得します。

構文

retVal = ShellWindows.Item(
  [ iIndex ]
)

パラメーター

iIndex [in, optional]

型: Variant

取得する項目の 0 から始まるインデックス。 この値は 、Count プロパティの値より小さくする必要があります。 この値を省略すると、既定値の 0 が使用されます。

戻り値

種類: IDispatch**

シェル ウィンドウを表す InternetExplorer オブジェクトへのオブジェクト参照。

次の例では 、Item を 使用して、最初のシェル ウィンドウ項目を表す InternetExplorer オブジェクトを取得します。 JScript、VBScript、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

必要条件

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