event InvokeItemMenu (Command as Long)
Notifies the application once the user selects a command in the context menu.

TypeDescription
Command as Long A Long expression that indicates the identifier of the command being selected.
The InvokeItemMenu event notifies the application once the user selects an item from the control's context menu. For instance, you can use the InvokeItemMenu event to be notified when the user changes the view mode. The ViewMode property determines the current view mode. Use the InvokeMenuCommand event to be notifies when the user selects a custom command that previously was added using the QueryContextMenu event.

Syntax for InvokeItemMenu event, /NET version, on:

private void InvokeItemMenu(object sender,int Command)
{
}

Private Sub InvokeItemMenu(ByVal sender As System.Object,ByVal Command As Integer) Handles InvokeItemMenu
End Sub

Syntax for InvokeItemMenu event, /COM version, on:

private void InvokeItemMenu(object sender, AxEXSHELLVIEWLib._IExShellViewEvents_InvokeItemMenuEvent e)
{
}

void OnInvokeItemMenu(long Command)
{
}

void __fastcall InvokeItemMenu(TObject *Sender,long Command)
{
}

procedure InvokeItemMenu(ASender: TObject; Command : Integer);
begin
end;

procedure InvokeItemMenu(sender: System.Object; e: AxEXSHELLVIEWLib._IExShellViewEvents_InvokeItemMenuEvent);
begin
end;

begin event InvokeItemMenu(long Command)
end event InvokeItemMenu

Private Sub InvokeItemMenu(ByVal sender As System.Object, ByVal e As AxEXSHELLVIEWLib._IExShellViewEvents_InvokeItemMenuEvent) Handles InvokeItemMenu
End Sub

Private Sub InvokeItemMenu(ByVal Command As Long)
End Sub

Private Sub InvokeItemMenu(ByVal Command As Long)
End Sub

LPARAMETERS Command

PROCEDURE OnInvokeItemMenu(oExShellView,Command)
RETURN

Syntax for InvokeItemMenu event, /COM version (others), on:

<SCRIPT EVENT="InvokeItemMenu(Command)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function InvokeItemMenu(Command)
End Function
</SCRIPT>

Procedure OnComInvokeItemMenu Integer llCommand
	Forward Send OnComInvokeItemMenu llCommand
End_Procedure

METHOD OCX_InvokeItemMenu(Command) CLASS MainDialog
RETURN NIL

void onEvent_InvokeItemMenu(int _Command)
{
}

function InvokeItemMenu as v (Command as N)
end function

function nativeObject_InvokeItemMenu(Command)
return

The following VB sample displays a message box when the user changes the view mode:

Dim nVM As EXSHELLVIEWLibCtl.ViewModeType

Private Sub ExShellView1_InvokeItemMenu(ByVal Command As Long)

    If (nVM <> ExShellView1.ViewMode) Then
        nVM = ExShellView1.ViewMode
        MsgBox "ViewMode changed to " & nVM
    End If

End Sub

Private Sub Form_Load()
    nVM = ExShellView1.ViewMode
End Sub

The sample holds the current view mode when the application starts on nVM variable. Once the InvokeItemMenu event occurs, the nVM variable is checked with the current view mode, and if it changed, a message box is displayed that the user has changed the view mode.

The following C# sample displays a message box once the user changes the control's view mode:

public Form1()
{
    InitializeComponent();

    nVM = exshellview1.ViewMode;
}

exontrol.EXSHELLVIEWLib.ViewModeType nVM = exontrol.EXSHELLVIEWLib.ViewModeType.Details;
private void exshellview1_InvokeItemMenu(object sender, int Command)
{
    if ( nVM != exshellview1.ViewMode )
    {
        nVM = exshellview1.ViewMode;
        MessageBox.Show( "ViewMode changed to " + nVM.ToString());
    }
}

The Values for the Command parameter are determined by the system, and are the same for any Windows version. For instance, the 30995 indicates a Rename operation, while the 30996 command invokes the Properties dialog of selected file or folder.

The following VB sample displays the command being performed:

Private Sub ExShellView1_InvokeItemMenu(ByVal Command As Long)
    Debug.Print Command
End Sub