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

    GetKeyState(): How do I...

    How do I interpret the return value from GetKeyState(). In particular I am trapping
    for a <Ctrl-C> keyboard entry. I have trapped the WM_DOWNKEY message for
    the 'C' part and now I have to look at the 'high-order' bit of the GetKeyState(VK_CONTROL)
    return value to see if the <Ctrl> key was also depressed. How do I check the high-order
    bit of the return value?

    Thanks in advance for any help!

    Eric

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: GetKeyState(): How do I...

    Answer:
    GetKeyState(key) & 0x8000;

    Reason:
    The 0x8000 translates to "1000 0000 0000 0000" in binary. Note that the only "1" is the left-most bit (the high order bit).

    Regards,

    Paul McKenzie


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