Friday 26 June 2009

C++ color script

#include iostream //you need to use >< on the headers, I can't use them at this page
#include windows.h

using namespace std;

HANDLE SetColor(
HANDLE console,
int fg = FOREGROUND_RED| FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
int bg = 0)

{
if(console == NULL)
console = GetStdHandle(STD_OUTPUT_HANDLE);

SetConsoleTextAttribute(console, fg | bg);

return console;
}


int main()
{
HANDLE console = SetColor(NULL, FOREGROUND_GREEN, FOREGROUND_RED);
cout << "Hello World" << console =" SetColor(NULL," console =" SetColor(NULL,">

1 comment:

  1. are the only colors green red and blue?
    need it asap..thanks

    ReplyDelete