What is the Windows Message send when the spacebar is pressed
Printable View
What is the Windows Message send when the spacebar is pressed
umm, the ASCII for space is 32 :)
Use this:
Or this:Code:
case WM_CHAR:
/* handle keyboard input */
switch ((int)wParam) {
break;
case VK_SPACE:
/* Your code here */
break;
default:
break;
}
break;
Code:
if(GetAsyncKeyState(VK_SPACE)){
/* Your code here */ }
The reason we use VK_SPACE is because different keyboard layouts could produce different outputs, so with a virtual key, windows will figure it out for us.
Sorry needed some fixing, had an extra break in the beginningCode:case WM_CHAR:
/* handle keyboard input */
switch (wParam)
{
case VK_SPACE:
/* Your code here */
break;
}
return 0;
Sorry, I don't know why I put that there.