在下面的代碼中,我該如何在控制檯底部創建一個彩色條? 下面的代碼使得酒吧在最頂端,但我不想在底部創建酒吧。我該怎麼做?控制檯圖形幫助!
void main(void)
{
HANDLE hOutput = (HANDLE)GetStdHandle(STD_OUTPUT_HANDLE);
// Set the text output position to (5,10)
COORD sPos;
sPos.X = 5;
sPos.Y = 10;
SetConsoleCursorPosition(hOutput, sPos);
// Set the color to bright green
SetConsoleTextAttribute(hOutput,
FOREGROUND_INTENSITY | FOREGROUND_GREEN);
// Write the text
DWORD nWritten;
WriteConsole(hOutput, "This is a test", 14, &nWritten, NULL);
CHAR_INFO buffer[SCREEN_HEIGHT][SCREEN_WIDTH];
COORD dwBufferSize = { SCREEN_WIDTH,SCREEN_HEIGHT };
COORD dwBufferCoord = { 0, 0 };
SMALL_RECT rcRegion = { 0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1 };
WriteConsoleOutput(hOutput, (CHAR_INFO *)buffer, dwBufferSize,
dwBufferCoord, &rcRegion);
}
Windows應用程序沒有'void main()'函數。 – 2011-05-15 12:42:01