Share via


Overview | Methods | Fields | This Package | All Packages

OverviewMethodsFieldsThis PackageAll Packages

Control.preProcessMessage

This method is called by the application's message loop to preprocess input messages before they are dispatched.

Syntax

public boolean preProcessMessage( MSG msg )

Parameters

msg

The message to process. Possible values for the message field of the msg parameter are WM_KEYDOWN, WM_SYSKEYDOWN, WM_CHAR, and WM_SYSCHAR.

Return Value

Returns true if the method processes the message; otherwise, returns false. If the method processes the message, the message loop will not dispatch the message. 

Remarks

For WM_KEYDOWN and WM_SYSKEYDOWN messages, the preProcessMessage method first calls the processCmdKey method to check for command keys such as accelerator keys. If the processCmdKey method doesn't process the message, the isInputKey method is called to check whether the key message represents an input key for the control. Finally, if the isInputKey method indicates that the control isn't interested in the key message, the processDialogKey method is called to check for dialog box keys such as the TAB key, arrow keys, and mnemonic characters.

For WM_CHAR messages, the preProcessMessage method first calls the isInputChar method to check whether the character message represents an input character for the control. If the isInputChar method indicates that the control isn't interested in the character message, the processDialogChar method is called to check for dialog box keys such as mnemonic characters. For WM_SYSCHAR messages, the preProcessMessage method calls the processDialogChar method to check dialog box keys such as mnemonic characters.

When overriding the preProcessMessage method, a control should return true to indicate that it has processed the message. For messages that aren't processed by the control, the control should return the result of the super.preProcessMessage method. Controls will typically override one of the more specialized methods (such as isInputChar, isInputKey, processCmdKey, processDialogChar, or processDialogKey) instead of overriding the preProcessMessage method.