event QueryContextMenu (ByRef Items as String, ByRef Separator as String)
Fired when the context menu is about to be shown.

TypeDescription
Items as String (By Reference) A String expression that indicates the list of custom commands being added.
Separator as String (By Reference) A String expression that indicates the separator for the list of commands in the Items parameter. 
Use the QueryContextMenu to supply new items to the control's context menu. Use the QueryContextMenu event to display your own popup/context menu. The DefaultMenuItems property specifies whether the control displays the default context menu. The InvokeMenuCommand event notifies your application that the user selects a custom command. If you need to provide your own context menu, set the DefaultMenuItems property on False, and handle the QueryContextMenu event when your context menu to be shown.

Syntax for QueryContextMenu event, /NET version, on:

private void QueryContextMenu(object sender,ref string Items,ref string Separator)
{
}

Private Sub QueryContextMenu(ByVal sender As System.Object,ByRef Items As String,ByRef Separator As String) Handles QueryContextMenu
End Sub

Syntax for QueryContextMenu event, /COM version, on:

private void QueryContextMenu(object sender, AxEXSHELLVIEWLib._IExShellViewEvents_QueryContextMenuEvent e)
{
}

void OnQueryContextMenu(LPCTSTR FAR* Items,LPCTSTR FAR* Separator)
{
}

void __fastcall QueryContextMenu(TObject *Sender,BSTR * Items,BSTR * Separator)
{
}

procedure QueryContextMenu(ASender: TObject; var Items : WideString;var Separator : WideString);
begin
end;

procedure QueryContextMenu(sender: System.Object; e: AxEXSHELLVIEWLib._IExShellViewEvents_QueryContextMenuEvent);
begin
end;

begin event QueryContextMenu(string Items,string Separator)
end event QueryContextMenu

Private Sub QueryContextMenu(ByVal sender As System.Object, ByVal e As AxEXSHELLVIEWLib._IExShellViewEvents_QueryContextMenuEvent) Handles QueryContextMenu
End Sub

Private Sub QueryContextMenu(Items As String,Separator As String)
End Sub

Private Sub QueryContextMenu(Items As String,Separator As String)
End Sub

LPARAMETERS Items,Separator

PROCEDURE OnQueryContextMenu(oExShellView,Items,Separator)
RETURN

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

<SCRIPT EVENT="QueryContextMenu(Items,Separator)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function QueryContextMenu(Items,Separator)
End Function
</SCRIPT>

Procedure OnComQueryContextMenu String llItems String llSeparator
	Forward Send OnComQueryContextMenu llItems llSeparator
End_Procedure

METHOD OCX_QueryContextMenu(Items,Separator) CLASS MainDialog
RETURN NIL

void onEvent_QueryContextMenu(COMVariant /*string*/ _Items,COMVariant /*string*/ _Separator)
{
}

function QueryContextMenu as v (Items as C,Separator as C)
end function

function nativeObject_QueryContextMenu(Items,Separator)
return

For instance the following VB sample adds 3 more items in the control's default context menu:

Private Sub ExShellView1_QueryContextMenu(Items As String, Separator As String)
    Separator = ","
    Items = ",First,Second,Third"
End Sub

and so the control's context menu shows three more items as in the following screen shot:

and if the DefaultMenuItems property is set on False, the context menu shows only the new three items:

The first separator item in the context menu is not shown because we have used Items = "First,Second,Third" instead Items = ",First,Second,Third"