Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 4th, 2006, 6:27 AM   #1
sayu
Newbie
 
Join Date: Nov 2006
Posts: 10
Rep Power: 0 sayu is on a distinguished road
Console Background

Hello
Can any one the code required to
change the console background color
or the color of user screen

Thank you
Kishore
sayu is offline   Reply With Quote
Old Nov 4th, 2006, 7:17 AM   #2
Iftikhar
Programmer
 
Iftikhar's Avatar
 
Join Date: Oct 2006
Location: London
Posts: 40
Rep Power: 0 Iftikhar is on a distinguished road
Send a message via MSN to Iftikhar
There are two modes
In graphics mode use setbkcolor(colorNumber);
In text mode use textbackground(colorNumber);
colorNumber = 0-255 in Graphics mode, 0-15 in textMode
__________________
Iftikhar Ahmed Khan
For doing an experiment on programmer's mood please visit http://uxisfyp1.brunel.ac.uk/cspgiak
Iftikhar is offline   Reply With Quote
Old Nov 4th, 2006, 7:56 AM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
There is no standard C++ way of doing this, as the operation is platform specific. On top of that, it's usually OS specific, as well. You don't mention either of those things, so a definitive answer isn't possible.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 4th, 2006, 1:25 PM   #4
v0id
Hobbyist Programmer
 
Join Date: Apr 2006
Posts: 155
Rep Power: 3 v0id is on a distinguished road
In Windows you can change the textcolor and textbackgroundcolor in the console.
#include <windows.h>
// ...
HANDLE MyHandle = GetStdHandle(STD_OUTPUT_HANDLE);
SetColorTextAttribute(MyHandle, FOREGROUND_WHITE | BACKGROUND_RED);
Don't know if it was what you exactly were looking after, but good luck!
__________________
-- v0id
v0id is offline   Reply With Quote
Old Nov 5th, 2006, 12:42 PM   #5
java_roshan
Professional Programmer
 
Join Date: Mar 2005
Location: Student of University of Mumbai, Maharashtra State, India
Posts: 344
Rep Power: 4 java_roshan is on a distinguished road
In Windows XP, if you are using Turbo C++ 3.0, you can use the system function to change the console background color.

Try running color command in Windows XP. Find out more, by typing color /?
__________________
Visit: http://www.somaiya.edu
java_roshan is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pause \ stop background worker john Wesley Visual Basic .NET 1 Aug 21st, 2006 9:31 AM
The Black Art of Video Game Console Design lostcauz Book Reviews 0 Apr 26th, 2006 8:31 PM
background images boz Java 0 Sep 11th, 2005 6:02 PM
Neat little program... Sane Python 3 Apr 10th, 2005 6:49 PM
Printing rich text with colored background jarrod C# 1 Feb 23rd, 2005 12:48 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:41 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC