Detecting an arrowkey??

This is a discussion on Detecting an arrowkey?? within the C++ Programming forums, part of the General Programming Boards category; How can I tell the user if they press the UP, DOWN, LEFT, or RIGHT arrow keys?? (Bloodshed Dev-C++ 4..Win98)...

  1. #1
    BubbleMan
    Guest

    Question Detecting an arrowkey??

    How can I tell the user if they press the UP, DOWN, LEFT, or RIGHT arrow keys?? (Bloodshed Dev-C++ 4..Win98)

  2. #2
    Registered User WayTooHigh's Avatar
    Join Date
    Aug 2001
    Posts
    101
    you could do something like this in your main switch statement:

    Code:
    case WM_KEYDOWN:
    	switch(wParam)
    	{
    	case VK_UP:
    		MessageBox(0,"UP ARROW PUSHED","UP",0);
    		
    		break;
    
    	case VK_DOWN:
    		MessageBox(0,"DOWN ARROW PUSHED","DOWN",0);
    		
    		break;
    
    	case VK_LEFT:
    		MessageBox(0,"LEFT ARROW PUSHED","LEFT",0);
    		
    		break;
    
    	case VK_RIGHT:
    		MessageBox(0,"RIGHT ARROW PUSHED","RIGHT",0);
    		
    		break;
    	}
    	return TRUE;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Accurately detecting function calls
    By Mole42 in forum C Programming
    Replies: 5
    Last Post: 05-17-2009, 04:01 AM
  2. Detecting empty file situation.
    By xIcyx in forum C Programming
    Replies: 9
    Last Post: 06-18-2008, 10:37 PM
  3. Detecting the OS
    By John.H in forum C++ Programming
    Replies: 3
    Last Post: 02-21-2003, 08:50 AM
  4. Unix - memory leaks detecting.
    By SOUND in forum C++ Programming
    Replies: 3
    Last Post: 12-14-2002, 06:24 PM
  5. Detecting two consecutive spaces in string
    By bob2509 in forum C++ Programming
    Replies: 20
    Last Post: 04-22-2002, 01:48 PM

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