Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Meaning of GetAsyncKeyState(VK_SHIFT) & 0x8000???

1,065 views
Skip to first unread message

Bob Rock

unread,
Oct 14, 2003, 5:55:23 PM10/14/03
to
Hello,

I was wondering the reasong for the bitwise and with 0x8000.
What does GetAsyncKeyState(VK_SHIFT) & 0x8000 return?


Thank you.

Bob Rock


Elias Fotinis

unread,
Oct 14, 2003, 6:07:22 PM10/14/03
to
Bob Rock wrote:
> What does GetAsyncKeyState(VK_SHIFT) & 0x8000 return?

It checks whether the most-significant bit of the function's return
value is set. If so, it means that the shift key is currently pressed.

Lucian Wischik

unread,
Oct 15, 2003, 4:35:07 AM10/15/03
to

The other idiom, which amounts to the same thing (I think), is
if (GetAsyncKeyState(VK_SHIFT)<0) // then it's pressed

--
Lucian

Elias Fotinis

unread,
Oct 15, 2003, 5:52:25 AM10/15/03
to

Yes, that's exactly what I use too; it involves less typing :)

0 new messages