GetKeyState 0x80 offset?

Started by
1 comment, last by aviosity 18 years, 4 months ago
Hey all, This is just for my general knowledge/enrichment, since Windows programming isn't really my gig (transferring over from Java here :-P). When using GetKeyState(VK_XXX), you always see it offset by 0x80 (using &). Now I've experimented with removing the offset, and in my application it quite obviously affects something (using it to control camera movement results in the camera just shooting through all geometry on its merry way to negative z oblivion). What does this 0x80 do? I've tried googling and searching the forums, but got nothing...sorry if I missed something, and thanks for any help. Aviosity
Advertisement
GetKeyState doesn't only return whether or not the key is down. The high order of the return value says whether or not the key is down. Saying & 80 is a fancy and easier way of seeing which bits (the high bits) are set in the return value.

If you don't understand the AND (&) part, then it's very advisable to study up on your bitwise operations. They come in mighty useful. [smile]
Thanks, and I'll do that studying :)

This topic is closed to new replies.

Advertisement