CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Keyboard-Hook - How to correctly interprete upper case?

    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?

  2. #2
    Join Date
    Feb 2002
    Posts
    3,788

    Re: Keyboard-Hook - How to correctly interprete upper case?

    have you tried using GetAsyncKeyState, GetKeyState or GetKeyboardState?

  3. #3
    Join Date
    Mar 2009
    Posts
    2

    Re: Keyboard-Hook - How to correctly interprete upper case?

    Yes, i tried GetAsyncKeyState, but it's the same problem. I only get the key code for Shift wenn i press down shift. No information when the Shift key is released.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured