Pressed Spacebar

This is a discussion on Pressed Spacebar within the Windows Programming forums, part of the Platform Specific Boards category; What is the Windows Message send when the spacebar is pressed...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    15

    Pressed Spacebar

    What is the Windows Message send when the spacebar is pressed

    (x) (x) the year 2010 smiley
    \_____/



  2. #2
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    umm, the ASCII for space is 32
    what does signature stand for?

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Use this:

    Code:
     
    	case WM_CHAR:
     /* handle keyboard input */
     switch ((int)wParam) {
    		break;
     case VK_SPACE:
    	 /* Your code here */
    	 break;
     default:
    	 break;
     }
     break;
    Or this:
    Code:
     
    
       if(GetAsyncKeyState(VK_SPACE)){
       /* Your code here */  }

  4. #4
    *this
    Join Date
    Mar 2005
    Posts
    498
    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.

    Code:
    case WM_CHAR:
       /* handle keyboard input */
       switch (wParam) 
       {
          case VK_SPACE:
             /* Your code here */
    	 break;
       }
    
       return 0;
    Sorry needed some fixing, had an extra break in the beginning
    Last edited by JoshR; 08-02-2005 at 11:57 AM.

  5. #5
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Sorry, I don't know why I put that there.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Check if a key has been pressed and released
    By xkrja in forum Windows Programming
    Replies: 3
    Last Post: 09-19-2006, 09:06 AM
  2. spacebar problem?
    By limitmaster in forum Tech Board
    Replies: 2
    Last Post: 07-17-2006, 07:07 AM
  3. Pressed keys problem
    By Snip in forum Game Programming
    Replies: 2
    Last Post: 08-31-2005, 07:41 AM
  4. Replies: 2
    Last Post: 07-25-2003, 03:01 AM
  5. how do you know when enter is pressed?
    By pinkcheese in forum Windows Programming
    Replies: 6
    Last Post: 07-26-2002, 12:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21