Your code matches the official delphi documentation. The first parameter to SetConsoleTextAttribute is a handle to the console screen buffer. This is what GetStdHandle(STD_OUTPUT_HANDLE) provides - a...