method ExFileView.ExecuteContextCommand (FileName as String, Folder as Boolean, Command as String)

Executes a context menu command.

TypeDescription
FileName as String A string expression that indicates the file whose context menu is invoked.
Folder as Boolean A boolean expression that indicates whether the FileName points to a folder or to a file.
Command as String A string expression that indicates the name of the command being invoked or a string expression that indicates the identifier of command being invoked.

The ExecuteContextCommand method executes the object's context menu command. The control returns no error, if the command is not found. Use the AllowContextMenu property to disable the control's context menu when user right clicks a file in the browser. Use the Get property to retrieve the selected item(s). Use the Name property to specify the name of the file or the folder. Use the Folder property to specify whether the File object refers a file or a folder.

Here's the list of the identifiers for some known items in the object's context menu :

The following VB sample opens that file being double clicked:

Private Sub ExFileView1_DblClick()
    With ExFileView1.Get(SelItems)
        If (.Count > 0) Then
            With .Item(0)
                If (Not .Folder) Then
                    ExFileView1.ExecuteContextCommand .Name, .Folder, "Open"
                End If
            End With
        End If
    End With
End Sub

The following VB sample opens a file that user double clicks ( the sample uses the Open's identifier, in case your application is not displaying the English messages ) :

Private Sub ExFileView1_DblClick()
    With ExFileView1.Get(SelItems)
        If (.Count > 0) Then
            With .Item(0)
                If (Not .Folder) Then
                    ExFileView1.ExecuteContextCommand .Name, .Folder, "102"
                End If
            End With
        End If
    End With
End Sub

The following C++ sample opens that file being double clicked:

void OnDblClickExfileview1() 
{
	CFiles files = m_fileview.GetGet( 0 );
	if ( files.GetCount() > 0 )
	{
		CFile1 file = files.GetItem( COleVariant( (long)0 ) );
		m_fileview.ExecuteContextCommand( file.GetName(), file.GetFolder(), "Open" );
	}	
}

The following VB.NET sample opens that file being double clicked:

Private Sub AxExFileView1_DblClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxExFileView1.DblClick
    With AxExFileView1.get_Get(EXFILEVIEWLib.TypeEnum.SelItems)
        If (.Count > 0) Then
            With .Item(0)
                If (Not .Folder) Then
                    AxExFileView1.ExecuteContextCommand(.Name, .Folder, "Open")
                End If
            End With
        End If
    End With
End Sub

The following C# sample opens that file being double clicked:

private void axExFileView1_DblClick(object sender, EventArgs e)
{
	EXFILEVIEWLib.Files files = axExFileView1.get_Get(EXFILEVIEWLib.TypeEnum.SelItems);
	if (files.Count > 0)
	{
		EXFILEVIEWLib.File file = files[0];
		axExFileView1.ExecuteContextCommand(file.Name, file.Folder, "Open");
	}
}

The following VFP sample opens that file being double clicked:

*** ActiveX Control Event ***

With thisform.ExFileView1.Get(0)	&& SelItems
    If (.Count > 0) Then
        With .Item(0)
            If (Not .Folder) Then
                thisform.ExFileView1.ExecuteContextCommand(.Name, .Folder, "Open")
            EndIf
        EndWith
    EndIf
EndWith