Thread: use different colors in console

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    11

    use different colors in console

    does any one know how can i use different text colors in the console for a DOS application?
    can any one provide me with a simple code for that?
    i am using VC++ 1.5 on win 2000
    Tnx

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210

  4. #4
    Registered User
    Join Date
    May 2007
    Posts
    11
    Quote Originally Posted by zacs7 View Post
    in the second code.....do we need to include any other headers other than those given? I am getting a lot of error messeges during compilation.

  5. #5
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    The code is fine. I believe you should update your compiler.

    What errors are you getting?

  6. #6
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Quote Originally Posted by zacs7 View Post
    Cool, thats one of the little things I was wondering how to do

  7. #7
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Since this is kind of relevent, I'll ask this here instead of starting a new thread.

    Is there a way that I can set the background colour for the console using the windows.h header?

    I can change the background colour of text like this:
    Code:
    SetConsoleTextAttribute ( h, BACKGROUND_RED | 0 );
    But I cant work out how to set the cls colour.

  8. #8
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by mike_g View Post
    Since this is kind of relevent, I'll ask this here instead of starting a new thread.

    Is there a way that I can set the background colour for the console using the windows.h header?

    I can change the background colour of text like this:
    Code:
    SetConsoleTextAttribute ( h, BACKGROUND_RED | 0 );
    But I cant work out how to set the cls colour.
    http://msdn2.microsoft.com/en-us/library/ms682073.aspx

    If it's not in there, it can't be done

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. location specific console colors
    By bennyandthejets in forum C Programming
    Replies: 7
    Last Post: 07-24-2002, 07:32 AM
  2. colors in DOS console based applications
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 06-09-2002, 10:37 PM
  3. Colors in DOS console
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 06-08-2002, 07:32 PM
  4. console text colors??
    By Agent89 in forum C++ Programming
    Replies: 5
    Last Post: 05-24-2002, 10:08 PM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM