DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    gokul_k Guest

    desperate need of help!!!!


    I'm working on a c++ program for a school project and I'm in desperate need
    of help. Is there anyway i can change the background color of the program
    from black to white? I've tried SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
    BACKGROUND_GREEN); but it only changes the background within the font. Is
    there any other way to change the background's color?

  2. #2
    ralph Guest

    Re: desperate need of help!!!!


    "gokul_k" <write2gokul@hotmail.com> wrote:
    >
    >I'm working on a c++ program for a school project and I'm in desperate need
    >of help. Is there anyway i can change the background color of the program
    >from black to white? I've tried SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
    >BACKGROUND_GREEN); but it only changes the background within the font. Is
    >there any other way to change the background's color?


    When you first create your buffer you can set the foreground and background
    using SetConsoleTextAttribute() to fill your whole buffer. M$ publishes a
    little routine that is used to 'clear' a screen, you can adapt that to "color"
    a screen.

    http://support.microsoft.com/default...b;EN-US;Q99261

    A cheap trick, (if you really aren't planning to use different colors is:
    system("color 70"); // at the start of your program
    ...
    system("color"); // at the end of your program

    this will produce black text on white.
    Type "color /?" on the cmd line to see your other options.



  3. #3
    ralph Guest

    Re: desperate need of help!!!!


    "ralph" <nt_consulting32@hotmail.com> wrote:
    > ...
    >A cheap trick, (if you really aren't planning to use different colors is:
    > system("color 70"); // at the start of your program
    > ...
    > system("color"); // at the end of your program
    >
    >this will produce black text on white.
    >Type "color /?" on the cmd line to see your other options.
    > ...


    I lied. The default color call ("color") will not work to set console colors
    back to the default inside a program on some windows versions.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links