Cesar
Cesar

Reputation: 389

What WINAPI responsible to detect keyboard state when 'parsing' WM_CHAR?

For example, if you press 2 on your keyboard at the notepad it generates WM_CHAR with x charCode, if you hold shift and press 2 it generates y charCode.

What WINAPI is responsible for detecting the keyboard state to 'build' the WM_CHAR according to it?

(obs: sorry don't speak english well)

Upvotes: 0

Views: 82

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 595762

Keyboard messages are queued in the receiving thread's message queue. Each thread maintains its own keyboard state machine. The translation of individual key messages into WM_CHAR messages is handled by the TranslateMessage() API function when called in the thread's message loop. This is stated as much in the WM_CHAR documentation:

Posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function.

Read About Keyboard Input for more details, particularly Keystroke Messages and Character messages.

Upvotes: 2

Related Questions