Type | Description | |||
Command as String | A string expression that specifies context menu item selected. | |||
ID as Long | A long integer that represents the unique ID of selected menu item. | |||
Cancel as Boolean | (By Reference) A boolean expression that, if set to True, execution of selected context menu item will be denied. If set to False, menu item will be executed. |
Right clicking on a folder results in the folder's context menu being displayed. If some item from this menu is selected, the control fires a pair of events to notify you. Before the menu item is executed, this event is fired. After the menu item is executed, AfterShellMenuCommand event is fired.
When this event is fired, you may deny execution of the selected menu item. Command variable holds name of selected menu item, and nID variable holds its unique index inside menu-items collection. Depending on user's choice, setting Cancel value to True will deny execution of selected menu item.
When checking Command's value, please keep in mind that some menu items have underscored letters. For example, 'Open' menu item usually have letter 'O' with underscore, which means that pressing ALT+O will result in executing of 'Open' command. Such underscored letters are stored internally in Windows OS by prefixing such letter with a '&' sign. So, if you check Command, don't forget to include this sign into string you will check Command with.
Following following code will not work correctly:
If Command = "Open" Then MsgBox "Folder
will be opened"
because '&Open' and 'Open' is not the same string. Rather, use this line (tested in VB):
If Command = "&Open" Then MsgBox
"Folder will be opened"
Syntax for BeforeShellMenuCommand event, /NET version, on:
private void BeforeShellMenuCommand(object sender,string Command,int ID,ref bool Cancel) { } Private Sub BeforeShellMenuCommand(ByVal sender As System.Object,ByVal Command As String,ByVal ID As Integer,ByRef Cancel As Boolean) Handles BeforeShellMenuCommand End Sub |
private void BeforeShellMenuCommand(object sender, AxEXFOLDERVIEWLib._IExFolderViewEvents_BeforeShellMenuCommandEvent e) { } void OnBeforeShellMenuCommand(LPCTSTR Command,long ID,BOOL FAR* Cancel) { } void __fastcall BeforeShellMenuCommand(TObject *Sender,BSTR Command,long ID,VARIANT_BOOL * Cancel) { } procedure BeforeShellMenuCommand(ASender: TObject; Command : WideString;ID : Integer;var Cancel : WordBool); begin end; procedure BeforeShellMenuCommand(sender: System.Object; e: AxEXFOLDERVIEWLib._IExFolderViewEvents_BeforeShellMenuCommandEvent); begin end; begin event BeforeShellMenuCommand(string Command,long ID,boolean Cancel) end event BeforeShellMenuCommand Private Sub BeforeShellMenuCommand(ByVal sender As System.Object, ByVal e As AxEXFOLDERVIEWLib._IExFolderViewEvents_BeforeShellMenuCommandEvent) Handles BeforeShellMenuCommand End Sub Private Sub BeforeShellMenuCommand(ByVal Command As String,ByVal ID As Long,Cancel As Boolean) End Sub Private Sub BeforeShellMenuCommand(ByVal Command As String,ByVal ID As Long,Cancel As Boolean) End Sub LPARAMETERS Command,ID,Cancel PROCEDURE OnBeforeShellMenuCommand(oExFolderView,Command,ID,Cancel) RETURN |
<SCRIPT EVENT="BeforeShellMenuCommand(Command,ID,Cancel)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function BeforeShellMenuCommand(Command,ID,Cancel) End Function </SCRIPT> Procedure OnComBeforeShellMenuCommand String llCommand Integer llID Boolean llCancel Forward Send OnComBeforeShellMenuCommand llCommand llID llCancel End_Procedure METHOD OCX_BeforeShellMenuCommand(Command,ID,Cancel) CLASS MainDialog RETURN NIL void onEvent_BeforeShellMenuCommand(str _Command,int _ID,COMVariant /*bool*/ _Cancel) { } function BeforeShellMenuCommand as v (Command as C,ID as N,Cancel as L) end function function nativeObject_BeforeShellMenuCommand(Command,ID,Cancel) return |