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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Colors in MS-Dos Window- Please Help

Status
Not open for further replies.

Luckygold6

Programmer
Jan 9, 2003
31
US
Is there actually a method of changing the color of text in the MS-Dos output window? If so, please post the syntax used.

Thanks in advance!
 
Can you please explain the code listed on that page?

Thanks in advance.
 
The best way to figure out how to use those functions is to start a new project, and add the msdn code to it. Get a compiling version, and then play around with the parameters. In the msdn code, notice that MyErrorExit is a placeholder. You can either write your own MyErrorExit code to handle error conditions (the best solution), or you can comment those function calls out.

background info:


you'll need the handle to your console process:

A handle is an index into the operating system's information about that object.

A console process uses handles to access the input and screen buffers of its console. A process can use the GetStdHandle, CreateFile, or CreateConsoleScreenBuffer function to open one of these handles.

Character attributes for the WriteConsoleOutputAttribute:
 
If anyone would also like to help elaborate it, please do so!

Thanks in advance and thanks to jennyy.
 
I feel bad about making retro suggestions, but if you're using a DOS window you could probably just use an old DOS compiler (if you can get your hands on one) which will have commands for setting the text colour directly.

Someone tell me if I'm wrong.

Dos text screens save 2 bytes per character. One is the character to be displayed, the other the attribute, which is such details as its colour, flashiness etc.
 
Interesting...

Can you elaborate on how I could do so?

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top