I'm using the WriteConsoleOutputCharacter and WriteConsoleOutputAttribute function to write text to a buffer in a console application. I've figured out WriteConsoleOutputCharacter and most of WriteConsoleOutputAttribute, but I can't seem to wrap my mind around the "CONST WORD *lpAttribute" var:
HANDLE hConsoleOutput, // handle to a console screen buffer
CONST WORD *lpAttribute, // pointer to buffer to write attributes from
DWORD nLength, // number of character cells to write to
COORD wWriteCoord, // coordinates of first cell to write to
LPDWORD lpNumberOfAttrsWritten // pointer to number of cells written to
I understand the basic concept of pointers, but I just can't figure out how to declare this var (how to select the color of the character to write to the buffer). I'm only writing one character at a time, if that has any influence on how to declare the var. I'd like to declare the attribute var by using numbers (i.e. 15 for white on black background), and not by the RED_BACKGROUND | BLUE_WHATEVER format, as the data I'm reading and writing to the buffer has the color defined by numbers. Any advice?