CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Colors

  1. #1
    Join Date
    Apr 1999
    Posts
    3

    Colors

    I have no idea on how to change the colors in the programs i write i.e
    void main()
    {
    cout << "hello" <<endl;
    }

    how would i go about making the word hello blue or yellow Ect.





  2. #2
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Colors

    You have to resort to Console functions to do this.
    SetConsoleTextAttribute will do specifically what you are after.
    You will need a handle to the console to use this and you can get it with :

    hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

    There are samples that illustrate more of what you can do with the console.



  3. #3
    Guest

    Re: Colors

    How retro textual! (sorry)

    You could learn all about ANSI.SYS (yech!) or look up the SetConsoleTextAttribute function (wincon.h) in the help system.

    Have fun,

    Dave Relyea

    P.S. SetConsoleTextAttribute requires NT 3.1+ or Win9x.


  4. #4
    Guest

    Re: Colors

    What is ansi.sys or that other one??
    I really ahve know idea what ths stuff is and if you could help out thanx.



  5. #5
    Join Date
    Apr 1999
    Posts
    3

    Re: Colors

    WHere do i find the exaples at?


    <b> WippKreem <\b> Sent this message
    <email> [email protected]<\email>

  6. #6
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: Colors

    There is a sample that comes with MSVC called Console.




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

Featured