Mr. Cluey : How To ...? : I hate waiting


I hate waiting!

This code, courtesy of Carl Gerstle, allows Partner to use the Cursor to determine when the wait is over. This routine does not use sleep statements, so you need not worry that the interval you specify is too long (performance hit) or too short (breaking your test).

void WaitForNonBusyCursor()
{
	// wait forever for cursor to return to non-hourglass mode
	// instead of doing a LoopWhileBusy(), do a version with a mouse movement
	// dither. Without the mouse movement, the active cursor can lock up as an hourglass
	
	BOOLEAN bMoveLeft = FALSE;
	while (Cursor.GetType () == "DELAY")
	{
		if bMoveLeft
		{
			Desktop.MoveMouse(400,400);	// move left
			bMoveLeft = FALSE;
		}
		else
		{
			Desktop.MoveMouse(401,400);	// move right
			bMoveLeft = TRUE;
			
		}
		sleep (1);
	}
}

Mr. Cluey : How To ...? : I hate waiting

Return to ATS Automated Testing Resources Page