Thread: ReadConsoleInput behaves bad.

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    80

    ReadConsoleInput behaves bad.

    The problem is that it seems to react twice to every keypress, and I don't have a clue what can be done about it.
    If anyone could help me with this I would be very grateful. Here is a piece of code.
    Code:
    	
    ----------------------------------------------------------------------------------
    while (truFals)
    	{
    		Sleep(1000);
    		GetNumberOfConsoleInputEvents(h, &eventcount);
    		if (eventcount > 0)
    		{
    			ReadConsoleInput(h, &input, 1, &read);
    			if (input.EventType == KEY_EVENT)
    			{
    				switch (input.Event.KeyEvent.wVirtualKeyCode)
    				{
    					case ESCAPE: truFals = FALSE; break;
    ----------------------------------------------------------------------------------

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Quote Originally Posted by MSDN KEY_EVENT_RECORD
    bKeyDown - If the key is pressed, this member is TRUE. Otherwise, this member is FALSE (the key is released).

    ...

    Keyboard input events are generated when any key, including control keys, is pressed or released.
    ~~~~

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    80
    Ok, many thanks! It works without problems now it seems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bad and fail of steam
    By George2 in forum C++ Programming
    Replies: 8
    Last Post: 02-19-2008, 03:07 AM
  2. Can you still view the bios screen with a bad CPU?
    By HyperCreep in forum Tech Board
    Replies: 4
    Last Post: 12-31-2006, 06:57 PM
  3. data loss bad bad bad
    By RoD in forum Tech Board
    Replies: 4
    Last Post: 05-01-2003, 12:06 PM
  4. Shocking(kind of)
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 12-10-2002, 08:52 PM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM