Override WndProc in your Control and do the following. You should then listen to keyup and show the context menu yourself.
[C#]
protected override void WndProc(ref Message m)
{
if(m.Msg == 0x7b /*WM_CONTEXTMENU*/ )
{
return;
}
if(m.Msg == 0x101 /*WM_KEYUP*/)
{
Keys keys = (Keys)m.WParam.ToInt32();
// Prevent this key from being processed.
if(keys == Keys.Apps)
return;
}
base.WndProc(ref m);
}
[VB.Net]
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = 0x7b Then ’WM_CONTEXTMENU
Return
End If
If m.Msg = 0x101 Then ’WM_KEYUP
Dim keys As Keys = CType(m.WParam.ToInt32(), Keys)
’ Prevent this key from being processed.
If keys = Keys.Apps Then
Return
End If
End If
MyBase.WndProc( m)
End Sub
Share with