Executes a command of the context menu of the current object.
const pCommand: TShellCommand
The command that should be executed.
True if the command was executed successfully.
Use InvokeContextMenuCommand to execute a command of the context menu of the current object. verb is the name of the command, which should be executed. Which commands are available depends on the current object. Always available and most important are:
default: Will execute the default action for a file and usually open it.
properties: Will show the properties dialog for the current object.
delete: Will delete the current object. If the current object is a file system object, it will be deleted to the recycle bin, if it is activated. The user will be asked, if he really would like to delete the object.
copy: Will copy the current object to the clipboard.
cut: Will cut the current object to the clipboard, the object will be moved with the next paste command.
paste: Will paste shell objects from the clipboard, if the current object is a folder.
runas: Will show a dialog as which user this file should be executed.
empty: Empty the recycle bin
copypath: Copies the path(s) to the clipbaord as text.
The following example will open a text file:
ShellBrowser.ObjectName := 'c:pathfile.txt'; ShellBrowser.InvokeContextMenuCommand('default');
The following example will show the drive properties with the pie chart of harddisk C:
ShellBrowser.ObjectName := 'c:'; ShellBrowser.InvokeContextMenuCommand('properties');
The following example will copy the file to the clipboard:
ShellBrowser.ObjectName := 'c:pathfile.txt'; ShellBrowser.InvokeContextMenuCommand('copy');