17.3.15 Writing Strings of Color Attributes to a Screen Buffer

Calls similar to those for writing text are available to set the color attributes of any character cell in a screen buffer. WriteConsoleOutputAttribute writes a string of attributes to the screen buffer at a specified location. This call might be used to highlight a string of characters by drawing them with a different color. FillConsoleOutputAttribute writes the same attribute for a specified number cells, beginning at a specified location in a screen buffer. This call might be used to set the color attributes for the entire screen buffer prior to writing text. The color attributes determine the foreground (text) and background colors in which the character will be drawn. The attributes may be set individually for each character cell. Refer to WINCON.H for the attribute constants that can be used in specifying attributes. The attributes may be ORed to achieve different colors. For example, the following combination results in bright cyan text:

FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY