staticbool keyIsDown[256];
...
case WM_KEYDOWN:
if ((lParam & 0x40000000) == 0) // Skip repeated keystrokes, see MSDN for details.
keyIsDown[wParam] = true;
if (keyIsDown[VK_LEFT])
{
...
}
if (keyIsDown['X'])
{
...
}
break;
case WM_KEYUP:
keyIsDown[wParam] = false;
break;
Not the most elegant solution, though I'm not sure what alternatives you have, other than using a library that handles input (DirectInput comes to mind).
Come on OP, the problem is your break statement. It isn't mandatory to put a "break" in every switch case block, but think about why we do it. It's because usually once a condition in a switch case block is met there is no reason to evaluate the other cases. But that's not true in this instance is it? Here you want to keep evaluating the other cases because, as your problem indicates, more then one key at a time might be pressed and your program needs to know to react to it.
Thanks for both the replies but I managed to fix it anyway, and I didn't think about the break statement at the time. And surely if I just remove the break statement it will just do the next part in the switch?