BOOL SetConsoleTextAttribute(hConsoleOutput, wAttr) | |||||
HANDLE hConsoleOutput; | /* console to set attributes for | */ | |||
WORD wAttr; | /* color attribute | */ |
The SetConsoleTextAttribute function sets the foreground and background color attributes to be used for characters that are subsequently written to the screen buffer by WriteFile or echoed by ReadFile. This function affects only text written after the change.
hConsoleOutput
Specifies an open handle with GENERIC_WRITE access to a console screen buffer.
wAttr
Specifies the foreground and background color attributes. Constants defined in wincon.h may be combined to create different colors. For example, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE will result in white text.
The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.
FillConsoleOutputAttribute