Results 1 to 10 of 10

Thread: VC++ 6.0 colored text??

  1. #1
    t420h
    Guest

    Question VC++ 6.0 colored text??

    how do yo umake colored text and backround for VC++ 6.0? i have tried things but they dont work... any ideas?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I suppose you mean how to choose the colors VC++ chooses for keywords and such.
    Tools->Options->Format (on the far right)
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    t420h
    Guest

    ...

    no....

    actually, what i wanted to know was how to change the color of the output text that the user will see

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Console or GUI app?

    Console: SetConsoleTextAttribute

    GUI: SetTextColor, SetBkColor
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5
    t420h
    Guest

    concole

    umm no its in a console application.. thanks if you can help me

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), flags);

    flags can be any combination of the following:
    FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED, FOREGROUND_INTENSITY, BACKGROUND_BLUE, BACKGROUND_GREEN, BACKGROUND_RED, and BACKGROUND_INTENSITY

    I think they are self-explaining.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7
    t420h
    Guest

    hmm

    hmmm, well i kind of see what your saying, but i cant get it to work, are there certain files i need to include or what?

    if you want you could show me a sample where this works.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Code:
    #include <windows.h>
    #include <iostream>
    using namespace std;
    
    int main()
    {
    	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
    		FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY |
    		BACKGROUND_BLUE | BACKGROUND_INTENSITY);
    	cout << "hello" << endl;;
    	return 0;
    }
    This text will be yellow on blue background.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9
    t420h
    Guest

    error

    i tried that, but i get this error....

    c:\source\t hall\test progs\colors.cpp(3) : error C2871: 'std' : does not exist or is not a namespace

  10. #10
    t420h
    Guest

    NEVERMIND

    NEVERMIND, I GOT IT TO WORK, THANKS A LOT

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width