FolderItemVerbs.Item 方法
擷取集合中指定專案的 FolderItemVerb 物件。
語法
retVal = FolderItemVerbs.Item(
iIndex
)
參數
-
iIndex [in]
-
類型: Variant
要擷取之項目的索引,此索引以零起始。 這個值必須小於 Count 屬性的值。
傳回值
類型: IDispatch**
接收 FolderItemVerb 物件的 物件。
範例
下列範例使用Item來擷取集合中可供主控台資料夾使用的第一個動詞,並顯示其名稱。 JScript、VBScript 和 Visual Basic 會顯示適當的使用方式。
Jscript:
<script language="JScript">
function fnFolderItemVerbsItemJ()
{
var objShell = new ActiveXObject("shell.application");
var objFolder2;
var ssfCONTROLS = 3;
objFolder2 = objShell.NameSpace(ssfCONTROLS);
if (objFolder2 != null)
{
var objVerbs;
objVerbs = objFolder2.Self.Verbs();
if (objVerbs != null)
{
var objFolderItemVerb;
objFolderItemVerb = objVerbs.Item(0);
if (objFolderItemVerb != null)
{
alert(objFolderItemVerb.Name);
}
}
}
}
</script>
VBScript:
<script language="VBScript">
function fnFolderItemVerbsItemVB()
dim objShell
dim objFolder2
dim ssfCONTROLS
ssfCONTROLS = 3
set objShell = CreateObject("shell.application")
set objFolder2 = objShell.NameSpace(ssfCONTROLS)
if (not objFolder2 is nothing) then
dim objVerbs
set objVerbs = objFolder2.Self.Verbs
if (not objVerbs is nothing) then
dim objFolderItemVerb
set objFolderItemVerb = objVerbs.Item(0)
if (not objFolderItemVerb is nothing) then
alert(objFolderItemVerb.Name)
end if
set objFolderItemVerb = nothing
end if
set objVerbs = nothing
end if
set objFolder2 = nothing
set objShell = nothing
end function
</script>
Visual Basic:
Private Sub fnFolderItemVerbsItemVB()
Dim objShell As Shell
Dim objFolder2 As Folder2
Dim ssfCONTROLS As Long
ssfCONTROLS = 3
Set objShell = New Shell
Set objFolder2 = objShell.NameSpace(ssfPROGRAMS)
If (Not objFolder2 Is Nothing) Then
Dim objVerbs As FolderItemVerbs
Set objVerbs = objFolder2.Self.Verbs
If (Not objVerbs Is Nothing) Then
Dim objFolderItemVerb As FolderItemVerb
Set objFolderItemVerb = objVerbs.Item(0)
If (Not objFolderItemVerb Is Nothing) Then
Debug.Print objFolderItemVerb.Name
End If
Set objFolderItemVerb = Nothing
End If
Set objVerbs = Nothing
End If
Set objFolder2 = Nothing
Set objShell = Nothing
End Sub
規格需求
需求 | 值 |
---|---|
最低支援的用戶端 |
Windows 2000 專業版、Windows XP [僅限傳統型應用程式] |
最低支援的伺服器 |
Windows 2000 Server [僅限傳統型應用程式] |
標頭 |
|
Idl |
|
DLL |
|