/* ************************************
* void NewLine(void) 
* 功能	新的一行,滚动屏幕
**************************************/
void NewLine(void) 
{ 
	if (! GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) 
	{
		MessageBox(NULL, "GetConsoleScreenBufferInfo", 
			"Console Error", MB_OK); 
		return;
	}

	csbiInfo.dwCursorPosition.X = 0; 

	if ((csbiInfo.dwSize.Y-1) == csbiInfo.dwCursorPosition.Y) 
	{ 
		ScrollScreenBuffer(hStdout, 1); 
	} 

	else csbiInfo.dwCursorPosition.Y += 1; 

	if (! SetConsoleCursorPosition(hStdout, 
		csbiInfo.dwCursorPosition)) 
	{
		MessageBox(NULL, "SetConsoleCursorPosition", "Console Error", 
			MB_OK); 
		return;
	}
} 
Ejemplo n.º 2
0
void NewLine(void) 
{ 
	if (! GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) 
	{
		MessageBox(NULL, TEXT("GetConsoleScreenBufferInfo"), 
			TEXT("Console Error"), MB_OK); 
		return;
	}

	csbiInfo.dwCursorPosition.X = 0; 

	// If it is the last line in the screen buffer, scroll 
	// the buffer up. 

	if ((csbiInfo.dwSize.Y-1) == csbiInfo.dwCursorPosition.Y) 
	{ 
		ScrollScreenBuffer(hStdout, 1); 
	} 

	// Otherwise, advance the cursor to the next line. 

	else csbiInfo.dwCursorPosition.Y += 1; 

	if (! SetConsoleCursorPosition(hStdout, 
		csbiInfo.dwCursorPosition)) 
	{
		MessageBox(NULL, TEXT("SetConsoleCursorPosition"), 
			TEXT("Console Error"), MB_OK); 
		return;
	}
}