Color codes

This is a discussion on Color codes within the C++ Programming forums, part of the General Programming Boards category; When you are doing something like: SetConsoleTextAttribute(hStdout, FOREGROUND_BLUE|BACKGROUND_RED); to set the background and foreground, what is the code for black?...

  1. #1
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44

    Color codes

    When you are doing something like:
    SetConsoleTextAttribute(hStdout, FOREGROUND_BLUE|BACKGROUND_RED);
    to set the background and foreground, what is the code for black?

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    If you want the foreground black, don't set any foreground colour.
    zen

  3. #3
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44
    Bah, thats what I thought, and it works the first time I run through the function with the color code, but for some reason every other time I run it, the background seems to run to other parts of the screen for no reason.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,659
    Umm, SetConsoleTextAttribute(hStdout, FOREGROUND_BLACK); ??



    ITSA
    Socket Library!

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21