The FillConsoleOutputAttribute function sets the text and background color attributes for a specified number of character cells, beginning at the specified coordinates in a screen buffer.
BOOL FillConsoleOutputAttribute(
HANDLE hConsoleOutput, // handle to screen buffer
WORD wAttribute, // color attribute to write
DWORD nLength, // number of character cells to write to
COORD dwWriteCoord, // x- and y-coordinates of first cell
LPDWORD lpNumberOfAttrsWritten
// pointer to number of cells written to
);
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the number of character cells whose attributes are to be set extends beyond the end of the specified row in the screen buffer, the cells of the next row are set. If the number of cells to write to extends beyond the end of the screen buffer, the cells are written up to the end of the screen buffer.
The character values at the positions written to are not changed.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in wincon.h.
Import Library: Use kernel32.lib.
Consoles and Character-Mode Support Overview, Console Functions, COORD, FillConsoleOutputCharacter, SetConsoleTextAttribute, WriteConsoleOutputAttribute