This documentation is archived and is not being maintained.

Control.PreProcessMessage Method

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

[Visual Basic]
Public Overridable Function PreProcessMessage( _
   ByRef msg As Message _
) As Boolean
public virtual bool PreProcessMessage(
   ref Message msg
public: virtual bool PreProcessMessage(
 Message* msg
public function PreProcessMessage(
   msg : Message
) : Boolean;


A Message, passed by reference, that represents the message to process.

Return Value

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


PreProcessMessage is called by the application's message loop to preprocess input messages before they are dispatched. Possible values for the msg.message field 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().


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

Control Class | Control Members | System.Windows.Forms Namespace