Control.PreProcessMessage(Message) Control.PreProcessMessage(Message) Control.PreProcessMessage(Message) Control.PreProcessMessage(Message) Method

定義

先於訊息迴圈中前置處理鍵盤或輸入訊息後,再分派這些訊息。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

參數

msg
Message Message Message Message

由參考傳遞的 Message,表示要處理的訊息。A Message, passed by reference, that represents the message to process. 可能的值包括 WM_KEYDOWN、WM_SYSKEYDOWN、WM_CHAR 和 WM_SYSCHAR。The possible values are WM_KEYDOWN, WM_SYSKEYDOWN, WM_CHAR, and WM_SYSCHAR.

傳回

如果控制項已處理訊息,則為 true,否則為 falsetrue if the message was processed by the control; otherwise, false.

備註

PreProcessMessage應用程式的訊息迴圈會呼叫,以便在分派之前預先處理輸入訊息。PreProcessMessage is called by the application's message loop to preprocess input messages before they are dispatched. msg參數的可能值為 WM_KEYDOWN、WM_SYSKEYDOWN、WM_CHAR 和 WM_SYSCHAR。Possible values for the msg parameter are WM_KEYDOWN, WM_SYSKEYDOWN, WM_CHAR, and WM_SYSCHAR.

當覆PreProcessMessage寫時,控制項true應該傳回以指出它已處理訊息。When overriding PreProcessMessage, a control should return true to indicate that it has processed the message. 若為不是由控制項處理的訊息,則base.PreProcessMessage應該傳回的結果。For messages that are not processed by the control, the result of base.PreProcessMessage should be returned. 控制項通常會覆寫其中一個較特製化的方法IsInputCharIsInputKey例如ProcessCmdKeyProcessDialogChar、、 ProcessDialogKey或,而PreProcessMessage不是覆寫。Controls will typically override one of the more specialized methods such as IsInputChar, IsInputKey, ProcessCmdKey, ProcessDialogChar, or ProcessDialogKey instead of overriding PreProcessMessage.

安全性

UIPermission
適用于立即呼叫端呼叫此方法的所有視窗。for all windows for the immediate caller to call this method. 相關聯的AllWindows列舉: UIPermissionWindow的值。Associated enumeration: AllWindows value of UIPermissionWindow.

適用於