Control.PreProcessMessage(Message) Method

Definition

Preprocesses keyboard or input messages within the message loop before they are dispatched.

public:
 virtual bool PreProcessMessage(System::Windows::Forms::Message % msg);
public virtual bool PreProcessMessage (ref System.Windows.Forms.Message msg);
abstract member PreProcessMessage : Message -> bool
override this.PreProcessMessage : Message -> bool
Public Overridable Function PreProcessMessage (ByRef msg As Message) As Boolean

Parameters

msg
Message

A Message, passed by reference, that represents the message to process. The possible values are WM_KEYDOWN, WM_SYSKEYDOWN, WM_CHAR, and WM_SYSCHAR.

Returns

true if the message was processed by the control; otherwise, false.

Remarks

PreProcessMessage is called by the application's message loop to preprocess input messages before they are dispatched. Possible values for the msg parameter are WM_KEYDOWN, WM_SYSKEYDOWN, WM_CHAR, and WM_SYSCHAR.

When overriding PreProcessMessage, a control should return true to indicate that it has processed the message. For messages that are not processed by the control, the result of base.PreProcessMessage should be returned. Controls will typically override one of the more specialized methods such as IsInputChar, IsInputKey, ProcessCmdKey, ProcessDialogChar, or ProcessDialogKey instead of overriding PreProcessMessage.

Applies to