WM_INPUT Keys Not Registering

Started by
1 comment, last by Endemoniada 9 years, 2 months ago

Hi guys,

I'm not sure what's happening here. If I hold down *both* the 'W' and 'S' keys the other keys won't register, but if I hold down *both* the 'A' and 'D' keys the other keys will register. I don't get it:


#define keyStateDown(flags) ((flags & RI_KEY_BREAK) ? 0 : 1)
 
// WM_INPUT handler
 
...
RAWINPUT* raw = (RAWINPUT*)lpb;
USHORT keyCode = raw->data.keyboard.VKey;
 
if (keyCode == key_w) // 0x57
 move_forward = keyStateDown(raw->data.keyboard.Flags);
else if (keyCode == key_s) // 0x53
 move_back = keyStateDown(raw->data.keyboard.Flags);
else if (keyCode == key_a) // 0x41
 move_left = keyStateDown(raw->data.keyboard.Flags); // breakpoint here
else if (keyCode == key_d) // 0x44
 move_right = keyStateDown(raw->data.keyboard.Flags); // breakpoint here

I set breakpoints and they don't get triggered.

Edit: the same thing happens if I use WM_KEYDOWN.

Advertisement

See Keyboards are Evil.

Basically, it's a hardware problem.

Thanks Dave, that's a pretty good article. I thought I was losing it.

This topic is closed to new replies.

Advertisement