Click to See Complete Forum and Search --> : Change font-color


Michael
05-02-2001, 09:42 AM
Hi!

How can I change the text-color and the
background-color of Win32-Console-Applications?

Thanks for helpin' me!

kene
05-07-2001, 12:13 PM
if you haven't aready found an answer here is one of the things I've found
to do this....function name is SetConsoleTextAttribute()


#include <windows.h>
#include <iostream.h>


void SetColor()
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
WORD wColors = FOREGROUND_RED | BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE
| BACKGROUND_INTENSITY;
SetConsoleTextAttribute(hConsole,wColors);
cout << "Testing....Red Text on White Background" << endl;
}
int main()
{

SetColor();
return(0);
}



"Michael" <MichaelBuesch@yahoo.de> wrote:
>
>Hi!
>
>How can I change the text-color and the
>background-color of Win32-Console-Applications?
>
>Thanks for helpin' me!