Pre Process Message Event

If you ever need to override the shortcuts (like Ctrl+O) of the editor, then using this event, you can achieve this goal.

You can override the following shortcuts:

Ctrl+OOpen web page
Ctrl+ASelect all
Ctrl+LOpen web page
Ctrl+NNew tab
Ctrl+MNew paragraph

The event PreProcessMessageEvent allows you to override low level messages of the editor web browser. You can't override the shortcuts using the KeyDown event or other events, because the web browser handles them on lower level.

The event raises in WYSYWYG mode before the editor browser starts preprocess messages.

The event signature (C#):

public event EventHandler<EditorPreProcessMessageEventArgs> PreProcessMessageEvent;

Class EditorPreProcessMessageEventArgs contains the following properties:

public Message Message {get;}
public bool Cancel { get; set; }

The message property is a System.Windows.Forms.Message structure.

HWndGets or sets the window handle of the message.
LParamSpecifies the LParam field of the message.
MsgGets or sets the ID number for the message.
ResultSpecifies the value that is returned to Windows in response to handling the message.
WParamGets or sets the WParam field of the message.

More info about the System.Windows.Forms.Message is here: (v=vs.110).aspx.

The Cancel property allows you to cancel futher processing of current message.

The following sample snippet shows how you can override behavior of Ctrl+O shortcut:

private void winFormHtmlEditor1_PreProcessMessageEvent

(object sender, SpiceLogic.HtmlEditorControl.Domain.BOs.EditorEventArgs.EditorPreProcessMessageEventArgs e)
    if (e.Message.Msg == 0x100 /* WM_KEYDOWN */ && e.Message.WParam.ToInt32() == (int)Keys.O && 

ModifierKeys == Keys.Control)
        //some custom code
        MessageBox.Show("Custom Ctrl+O shortcut handler here");

        //prevent default behavior of the editor for this shortcut
        e.Cancel = true;
Last updated on 22 April 2015, Wednesday, 12:36:21 AM
If you have any questions or concerns about this tutorial, Please feel free to share your comment.