Handling keyboard and mouse input (Win API)
Posted
by
Deluxe
on Game Development
See other posts from Game Development
or by Deluxe
Published on 2010-07-29T20:45:55Z
Indexed on
2013/06/25
16:30 UTC
Read the original article
Hit count: 1073574
There is a number of ways to catch mouse or keyboard under Windows. So I tried some of them, but every of them has some advantages and drawbacks. I want to ask you: Which method do use?
I've tried these:
WM_KEYDOWN/WM_KEYUP - Main disadvantage is that, I can't distinguish between left and right-handed keys like ALT, CONTROL or SHIFT.
GetKeyboardState - This solves problem of first method, but there is new one. When I get that the Right-ALT key is pressed, I also get that the Left-Control key is down. This behaviour happens only when using localized keyboard layout (Czech - CS).
WM_INPUT (Raw Input) - This method also doesn't distinguish left and right-handed keys (if I can remember) and for mouse movement sometimes generates message with zero delta values of mouse position.
© Game Development or respective owner