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 handle to the standard output. The second parameter to SetConsoleTextAttribute is the character attributes. In your case you are setting the foreground red and the background blue by or'ing the two values.

If you are using many of the console functions in one program, normally you would obtain the output handle only once, store this in a variable and then use this variable whenever the documentation requires a handle to console output.