If I program a keyboard hook with the KeyEvent function, i get the current key code from the LPARAM value in a DWORD.

key 'a' is for example 1966081

Now, if I want to write something in upper case and i press the shift key (shift = 2752513) how do I know, how long the shift key is pressed?

Because i only get the code 2752513 when I press DOWN the shift key, i get no information about when the shift key is released.

So if I press:

(Shift) h (Shift up) a u s

i mean -> Haus


But the only key codes i get are:

2293761 (shift)
2293761 (h)
1966081 (a)
1441793 (u)
2031617 (s)

But if I would press:

(Shift) h a u (Shift up) s

i mean -> HAUs


But i also get only the codes:

2293761 (shift)
2293761 (h)
1966081 (a)
1441793 (u)
2031617 (s)


How do I know, for how long the user presses the shift key, further how many following keys he wants to write in upper case?