windows 字元訊息——WM_CHAR

Mr_V_發表於2018-10-26

WM_CHAR

主要用於鍵盤字元按下的訊息,A-Z

#define WM_CHAR 0x0102

Parameters

  • wParam

The character code of the key.

字元對應的ASCII值

  • lParam

The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table.
Bits Meaning

指示按鍵狀態資訊,32位。

0-15 The repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.

低16位表示按鍵重複次數,當長按某一按鍵時,多次觸發訊息

16-23 The scan code. The value depends on the OEM.

OEM掃描碼是鍵盤傳送的碼值,由於此域是裝置相關的,因而此值往往被忽略。

24 Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.

擴充套件鍵標誌在有Alt鍵(或Ctrl鍵)按下時為1,否則為0

25-28 Reserved; do not use.

系統保留

29 The context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.

標誌Alt鍵是否保持按下

30 The previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.

訊息傳送時,鍵盤的前一個狀態,WM_SYSKEYDOWN訊息該值一直為0

31 The transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.

轉換狀態。保持釋放時為1,保持按壓時為0

相關文章