Re: [AD] Breakpointing an app in the MSVC 6 debugger can get a key to be stuck in Windows 2000

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I strongly suggest you upgrade from msvc6 it is considered quite broken and old.
I also suggest you try using WindowsXP instead of Windows 2000,
and the latest version of DirectX 9.0c i think that is at the moment.







Andrei Ellman wrote:

The following test program demonstrates a problem with the keyboard driver when debugging an app with MSVC 6 under Windows 2000. The program is supposed to display a message when the F2 key is held down and clear it when it is not held down. However, if I am debugging the program using the MSVC 6 debugger and I place a breakpoint on the line that is only supposed to be execuded if key[KEY_F2], then when I press F2, the compiler stops at the breakpoint, but if I release F2 before I resume, then the F2 key appears to be stuck. Only pressing F2 again can unstick it. Even pressing other keys does not unstick it.

This problem only appears on Windows 2000. If I do the same under Windows 98, the key manages to unstick itself even though it was released while the main program was stopping at a breakpoint. I am using MSVC 6 and Allegro 4.2.0 final.


AE.

------------------------------------------------------------------------

/***************************************************************************
*
* breakpointkbdtest.c
* Test program to show the Allegro keyboard handler failing to release a key if it was released during a break by the debugger.
*
**************************************************************************/


/****************************************************************************
Includes
*/

#include <allegro.h>


/****************************************************************************
 Types
*/

typedef int TeBool;


/****************************************************************************
Defines
*/





void
teDoTest()
{
	set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);		
	set_palette(desktop_palette);

	textout_ex(screen, font, "Hold down F2 to display some text", 0, 0, 1, 0);



	while(!key[KEY_ESC] && !key[KEY_SPACE])
	{
		if(key[KEY_F2])
		{
			// Place a breakpoint on the line below to see F2 getting stuck on Windows 2000
			textout_ex(screen, font, "F2 is pressed", 30, 20, 0, 1);
		}
		else
		{
			rectfill(screen,30,20,30+(13*8),20+8,0);
		}


	}

}



TeBool
teSetup()
{
	if(allegro_init())
	{
		TRACE("Error Initialising Allegro.\n");
		return FALSE;
	}


	if(install_keyboard())
	{
		TRACE("Error Initialising Keyboard.\n");
		return FALSE;
	}
	

	return TRUE;
}



void
teCleanUp()
{
	remove_keyboard();

	allegro_exit();
}



int main(void)
{
	if(!teSetup())
	{
		teCleanUp();
		return -1;
	}


	teDoTest();


	teCleanUp();

	return 0;
}
END_OF_MAIN();




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/