Click or drag to resize

ShellContextMenuProvider Class

Class providing the explorer context menu. It is used by ShellBrowser internally, but can is publicly available to either show the system context menu for a file or a list of files (ShowContextMenu(Int32, Int32, ShellContextMenuOptions)) or to execute command from the menu (ExecuteCommand(ShellCommand)).
Inheritance Hierarchy

Namespace:  Jam.Shell
Assembly:  ShellBrowser (in ShellBrowser.dll) Version: 7.1
Syntax
public class ShellContextMenuProvider : Win32ShellContextMenuProvider, 
	IDisposable

The ShellContextMenuProvider type exposes the following members.

Constructors
  NameDescription
Public methodShellContextMenuProvider(ItemIdList)
Creates a context menu for the passed ItemIdList.
Public methodShellContextMenuProvider(JamItemIdListCollection)
Creates a context menu for the passed JamItemIdListCollection.
Top
Properties
  NameDescription
Public propertyAsyncOperation
Gets or sets a value indicating whether context menu operations are executed asynchronously.
(Inherited from Win32ShellContextMenuProvider.)
Public propertyCustomMenuStrip
Sets the custom menu strip.
Protected propertyShellMenuStartsAt
Gets or sets a position of the first item of the shell menu.
(Inherited from Win32ShellContextMenuProvider.)
Public propertyShowShellContextMenuOnTop
Defines the order of ShellContextMenu and CustomMenuStrip.
Public propertySourceItems
Gets or sets source items.
(Inherited from Win32ShellContextMenuProvider.)
Top
Methods
  NameDescription
Protected methodCreatePopupMenu
Creates popup menu.
(Overrides Win32ShellContextMenuProviderCreatePopupMenu.)
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Protected methodDispose(Boolean)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public methodExecuteCommand(ShellCommand)
Executes the command operation on the SourceItems .
(Inherited from Win32ShellContextMenuProvider.)
Public methodExecuteCommand(ShellContextMenuCommand) Obsolete.
Executes the command operation on the SourceItems.
(Inherited from Win32ShellContextMenuProvider.)
Protected methodHandleMenuItem
Handles the menu item described by pCommandId.
(Overrides Win32ShellContextMenuProviderHandleMenuItem(Int32).)
Protected methodOnAfterCommandExecute
Executes the AfterCommandExecute event.
(Inherited from Win32ShellContextMenuProvider.)
Protected methodOnBeforeCommandExecute
Executes the BeforeCommandExecute event.
(Inherited from Win32ShellContextMenuProvider.)
Protected methodOnRenameItemSelected
Fires the RenameItemSelected event
(Inherited from Win32ShellContextMenuProvider.)
Protected methodRelease
Releases this object.
(Inherited from Win32ShellContextMenuProvider.)
Public methodShowContextMenu
Shows the context menu at the specified location and executes the menu item the user has chosen.
(Inherited from Win32ShellContextMenuProvider.)
Top
Events
  NameDescription
Public eventAfterCommandExecute
This event is fired after a command that was selected from the context menu or passed to ExecuteCommand(ShellContextMenuCommand) is processed.
(Inherited from Win32ShellContextMenuProvider.)
Public eventBeforeCommandExecute
This event is fired before a command that was selected from the context menu or passed to ExecuteCommand(ShellContextMenuCommand) is processed.
(Inherited from Win32ShellContextMenuProvider.)
Public eventRenameItemSelected
This event is fired when the context menu option "Rename" is selected from the context menu or passed to ExecuteCommand(ShellContextMenuCommand).
(Inherited from Win32ShellContextMenuProvider.)
Top
Examples
Showing the context menu for the Windows folder.
C#
using (ShellContextMenuProvider lContextMenu = new ShellContextMenuProvider(new ItemIdList(@"c:\windows")))
{
    lContextMenu.ShowContextMenu(100, 100, ShellContextMenuOptions.Extended);
}
Examples
Copy the files selected in the a ShellListView into a folder.
C#
shellListView1.InvokeCommandOnSelected(ShellCommand.Copy); //Copies the selected items to clipboard.
using (ShellContextMenuProvider lContextMenu = new ShellContextMenuProvider(new ItemIdList(@"d:\backup")))
{
    lContextMenu.ExecuteCommand(ShellCommand.Paste); //pastes the files into d:\backup.
}
See Also