ShellFolderItem.InvokeVerbEx method
Executes a verb on a Shell item.
Syntax
iRetVal = ShellFolderItem.InvokeVerbEx(
[ vVerb ],
[ vArgs ]
)
Parameters
-
vVerb [in, optional]
-
Type: Variant
A Variant that contains the verb string that corresponds to the command to be executed. It must be one of the values returned by the item's Name property. If no verb is specified, the default verb is executed.
-
vArgs [in, optional]
-
Type: Variant
A Variant that consists of a string with one or more arguments to the command specified by vVerb. The format of this string depends on the particular verb.
Remarks
A verb is a string used to specify a particular action that an item supports. Typically, calling a verb launches a related application. For example, calling the open verb on a .txt file normally opens the file with a text editor, usually Microsoft Notepad. The FolderItemVerbs object represents the collection of verbs associated with the item. For further discussion of verbs, see Launching Applications.
This method is similar to InvokeVerb, but it allows you to specify arguments to the command as well as the command itself.
Examples
The following examples show the proper use of this method in JScript, VBScript, and Visual Basic.
JScript:
<script language="JScript">
function fnFolderItem2InvokeVerbExJ()
{
var objShell = new ActiveXObject("shell.application");
var objFolder2;
var ssfWINDOWS = 36;
objFolder2 = objShell.NameSpace(ssfWINDOWS);
if (objFolder2 != null)
{
var objFolderItem;
objFolderItem = objFolder2.ParseName("NOTEPAD.EXE");
if (objFolderItem != null)
{
objFolderItem.InvokeVerbEx("open", "c:\\autoexec.bat");
}
}
}
</script>
VBScript:
<script language="VBScript">
function fnFolderItemInvokeVerbExVB()
dim objShell
set objShell = CreateObject("shell.application")
if (not objShell is nothing) then
dim objFolder2
dim ssfWINDOWS
ssfWINDOWS = 36
set objFolder2 = objShell.NameSpace(ssfWINDOWS)
if (not objFolder2 is nothing) then
dim objFolderItem
set objFolderItem = objFolder2.Self
if (not objFolderItem is nothing) then
objFolderItem.InvokeVerbEx()
end if
set objFolderItem = nothing
end if
set objFolder2 = nothing
end if
set objShell = nothing
end function
</script>
Visual Basic:
Private Sub fnFolderItem2InvokeVerbExVB()
Dim objShell As Shell
Dim objFolder2 As Folder2
Dim ssfWINDOWS As Long
ssfWINDOWS = 36
Set objShell = New Shell
Set objFolder2 = objShell.NameSpace(ssfWINDOWS)
If (Not objFolder2 Is Nothing) Then
Dim objFolderItem2 As Object
Set objFolderItem2 = objFolder2.ParseName("NOTEPAD.EXE")
If (Not objFolderItem2 Is Nothing) Then
objFolderItem2.InvokeVerbEx ("open")
Else
'FolderItem object returned nothing.
End If
Set objFolderItem2 = Nothing
Else
'Folder object returned nothing.
End If
Set objFolder2 = Nothing
Set objShell = Nothing
End Sub
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows 2000 Professional, Windows XP [desktop apps only] |
Minimum supported server |
Windows Server 2003 [desktop apps only] |
Header |
|
IDL |
|
DLL |
|
See also