Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Normal C++ Question

Status
Not open for further replies.

denisfinn

Programmer
Jun 7, 2003
49
US
Hey, it's me again..
any ways i figured some color might spruce up the way my programs look.
too bad i can't figure out how to do this.
If you could tell me it would be awesome.
I am not using Visual c++, I am just using a simple C++ compiler, any help will be appreciated.

thanks,
denis

 
That'd be platform-dependant. Mention what operating system, compiler, and library you're using and someone might be able to help you.
 
ok...
I am on Windows XP

I am using the Bloodshed DEV-C++ compiler, which can be downloaded for free at if you want to see what I am working with.

As for what library I am using, I have no clue. I am not to familiar with the C++ terms yet, seeing I only have about 3 weeks experience. If you could explain what a library is I would be more than willing to tell you :).

THANKKS,
Denis

 
i'm sure this is what i need...
but for some reason my stupidity is acting up and i don't understand any of that silly talk.

could you just tell me what to type in?

thanks,
denis
 
I can try. Keep in mind I don't normally program MSDN, and I'm not currently on a Windows machine to test the code, so it'll probably require some changes, minor or otherwise. Someone else can probably do a better job of this.

Code:
// Create a handle to the console
HANDLE console = CreateFile( "CONOUT$", ... );

// Set the text attributes on that console
SetConsoleTextAttribute( console,
                         FOREGROUND_BLUE |
                         FOREGROUND_GREEN |
                         FOREGROUND_INTENSITY |
                         BACKGROUND_BLUE );

// Write something to that console
WriteConsole( console, "Hello, blue world!\n", 19, ... );

I left some arguments out of the CreateFile and WriteConsole functions, but I think the major stuff is there. You can look up the missing arguments at MSDN, or I'm sure someone here can fill them in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top