Thread: Changing screen colour

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    15

    Question Changing screen colour

    Hi!!!!

    How can i change the colour of the screen when my program runs? (EG: from BLACK to RED);

    PLS help. tks...

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    What compiler / OS are you running..

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    15
    I am using Visual C++ 6.0
    My OS wins XP

  4. #4
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    Code:
    #include <windows.h>
    #include <stdio.h>
    
    int main(void)
    {
        HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
    
        SetConsoleTextAttribute(h, BACKGROUND_RED);
        printf("Hello\n");
    
        return 0;
    }
    Clear the screen to make the whole thing have a red background.

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    15
    Solve my problem le.....

    a BIG TKS to everyobe who help me.....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Colour and Screen Size
    By djlethal in forum C Programming
    Replies: 1
    Last Post: 11-24-2006, 09:29 PM
  2. Getting Pixel Colour Screen
    By god_of_war in forum C++ Programming
    Replies: 3
    Last Post: 03-14-2006, 01:17 PM
  3. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  4. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  5. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM